In reply to dave_59:
Hi,
I have question on this,
class A;
int a=10;
function void disp();
$display("a=%d",a);
endfunction
endclass
class B extends class A;
int a=20;
endclass
program main();
A a;
B b;
b =new();
b.disp(); //diplays a=10
$display("b.a=%d",b.a); // displays a=20
endprogram
My questions is, now b has two a’s and a disp() function. How does simulator know which value of a to display when I call b.disp() ?? what is the OOP concept governing this situation?
2nd question: How can I access a of base class with derived class handle in program block?