Overridden members system verilog classes

Status
Not open for further replies.

jdshah

Junior Member level 3
Joined
Dec 17, 2010
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Ahmedabad
Activity points
1,481
I have below query.
class my_a;
int member1 = 1;
endclass
class my_ea extends my_a;
int member1 = 2;
endclass

Now when I do
my_a A;
my_ea EA;
EA =new();
A=EA;
============================================================
EA = new(); has given handle to object of type my_ea to class variable EA.
A=EA; This pass the same handle (pointer value which points to object of my_ea) to A.
so , A.member1 should refer to value 2.

But it refer to value 1. why?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…