[sv-ec] virtual methods with static lifetime

From: danielm <danielm_at_.....>
Date: Fri Apr 04 2008 - 00:45:03 PDT
LRM doesn't say a word about virtual methods with static lifetime consider
the below example:
 
module top;
        class B;
                virtual function   static void f(input int i);
                endfunction
        endclass
 
        class C1 extends B;
                function  static void f(input int i);
                endfunction
                function   void disp();
                        $display(f.i);
                endfunction
 
        endclass
 
        class C2 extends B;
                function   static void f(input int i);
                endfunction
                function   void disp();
                        $display(f.i);
                endfunction
        endclass
 
        C1 c1=new;
        C2 c2=new;
        B b;
        initial begin
                b=c1;
                b.f(1);//1 should be assigned to static input variable i
from C1 - polymorphyzm for variables????
                c1.disp(); //it should display 1????
                b=c2;                
                b.f(2); //1 should be assigned to static input variable i
from C2 - polymorphyzm for variables????
                c2.disp();//it should display 2????
        end
endmodule

 
This case introduce completely new feature - which we may call virtual
static variables. 
It is allowed on purpose - or IEEE just forget to forbid explicitly that
methods with static lifetime cannot be virtual.
 
(NOTE: please note that static virtual methods are explicitly forbidden by
LRM, and dynamic methods with static lifetime are different)
 
 
DANiel

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Fri Apr 4 00:45:44 2008

This archive was generated by hypermail 2.1.8 : Fri Apr 04 2008 - 00:46:22 PDT