[sv-ec] Virtual function call from base class constructor

From: Daniel Mlynek <daniel.mlynek_at_.....>
Date: Wed Jun 25 2008 - 05:22:14 PDT
Maybe it should be explicitly said in LRM that in constructor function
polymorphism (function virtuality) should be ignored.
 
Consider below sample
 
 
class A;
 static integer file = $fopen("results.txt");
    virtual function t;
        $fdisplay(file, "base");
    endfunction
    
    function new;
        t;        // this should call A::t although t is virtual
    endfunction

    function f;
        t;        // this should call B::t bacause t is virtual 
    endfunction
 
endclass
 
class B extends A;
     
    virtual function t; 
  $fdisplay(file, "child");        // this should not be called
    endfunction
    
endclass
 
module top;
    
    B b;
    initial b = new;
endmodule
//expected results : 
//base
 
 
DANiel

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Wed Jun 25 05:23:04 2008

This archive was generated by hypermail 2.1.8 : Wed Jun 25 2008 - 05:23:46 PDT