In reply to dave_59:
Hi Dave,
Thank you for the reponse.
Let me show you with an example what I want to achieve.
class square;
int area;
function sq(int s)
area = s*s;
$display(“s = %0d area = %0d”,s,area);
endfunction
endclass
class square_ext extends square;
int perimeter;
function sq(int s)
area = ss;
perimeter = area2;
$display(“s = %0d area = %0d perimeter = %0d”,s,area,perimeter);
endfunction
endclass
In a top module;
square s;
square_ext s_ext = new();
$cast(s,s_ext);
s.sq(4);//Call the parent function (as expected as the function is non-virtual in the parent class)
//I want the child function to be invoked.
How can I override the non-virtual function “sq” ?