Erling Posted December 4, 2011 Report Share Posted December 4, 2011 I have a problem with virtual functions being treated as if they were non-virtual in a parameterized class. Consider: class MyComp #(type T) extends uvm_subscriber #(T); function new(); super.new("", null); endfunction function void f(); $display("%s", get_type_name()); endfunction function void write(T t); endfunction function string get_type_name(); return "MyComp#(T)"; endfunction endclass class MyOtherComp extends MyComp #(int); function string get_type_name(); return "MyOtherComp"; endfunction endclass initial begin MyOtherComp c = new(); c.f(); end I had hoped this would print "MyOtherComp" since get_type_name() is virtual in uvm_object, but what's printed is "MyComp#(T)". Is this a bug or am I missing something obvious? The compiler is Questa 10.0d. Erling Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.