Daniel, Draft 4 seems pretty clear about this: A virtual method may override a non-virtual method, but once a method has been identified as virtual, it shall remain virtual in any subclass that overrides it. In that case, the virtual keyword may be used in later declarations, but is not required. P1800-D4 8.19. Gord. danielm wrote: > There is no statement in LRM which defines if virtual keyword is > optional for virtual function. > Consider below example > > class B; > function void f; $display("b");endfunction > //this function is overriden by virtual fucntion in child class. is > it allowed? is this function virtual??? > endclass > > > class C extends B; > virtual function void f;$display("c"); endfunction > //this function is overrides nonvirtual from base class - is it > allowed? > endclass > > class D extends C; > function void f;$display("d"); endfunction > //this function declaration skips virtual keyword : is it legal? > is this function still virtual? > endclass > > B b=new; C c=new; D d=new; > > initial begin > b.f; > b=c; > b.f; > c.f; > b=d;c=d; > b.f; > c.f; > d.f; > end > > endmodule > > > Assuming that above should compile we may get 2 different results: > Result 1: > b > b > c > b > d > d > > Result 2: > b > c > c > d > d > d > > IMHO LRM should have explicit rules for above. and result 1 should be > correct. > > DANiel > > -- > This message has been scanned for viruses and > dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is > believed to be clean. -- -------------------------------------------------------------------- Gordon Vreugdenhil 503-685-0808 Model Technology (Mentor Graphics) gordonv@model.com -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Wed Apr 9 06:55:13 2008
This archive was generated by hypermail 2.1.8 : Wed Apr 09 2008 - 06:55:21 PDT