class base;
task A;
$display("A called");
B();
endtask
virtual task B;
$display("B Called");
endtask
endclass
class child extends base;
task B;
$display("B EXT called");
endtask
task super_A();
super.A();
endtask
endclass
module test;
initial begin
base bh;
child ch;
ch = new();
ch.A;
bh = ch;
bh.super_A();
end
endmodule
What is the output of this code?
In reply to MarshallX:
It will issue compile time error.
Like, super_A not found in “bh”. As super_A not part of base class.
What is your query on this. I mean what is your expectations ?
Thanks!
In reply to MarshallX:
Using parent class handle we can access only the overridden virtual methods of child class. As the method super_A is not the overridden virtual method in child class we can not access it using parent handle.
In reply to shanthi:
In reply to MarshallX:
Using parent class handle we can access only the overridden virtual methods of child class. As the method super_A is not the overridden virtual method in child class we can not access it using parent handle.
Thanks much for the information. It’s true with overridden virtual functions.