In reply to yourcheers:
Hi @yourcheers thank you for the reply
Yes I had the same doubt but instead of using the method disp() using this keyword can we use
this keyword with the property ‘a’ without defining the property ‘a’ inside the class ‘ab’.like I have done below or will the below code give an error because this keyword is used for current instance of class but ‘a’ is not defined in the current class it is defined in the class abc so this keyword should not work for property ‘a’.
class abc;
int a = 100;
function disp();
$display(a);
endfunction
endclass
class ab extends abc;
int xyz;
this.a=xyz;
function disp1();
this.disp();
endfunction
endclass
module aa;
ab a1 = new();
initial begin
a1.disp();
end
endmodule