In the code above,
x
,y
, andz
are different objects?
Yes, they occupy completely separate regions of storage.
The members of
z
are the same object?
No, z.a
and z.b
are two distinct objects. One can say that they are sub-objects of z
since the storage of each is contained in the storage of the whole, but it’s not the exact same region of storage. The size of the region also plays a part.
The elements of
y
are the same object?
No, each element of y
is a separate object. But by the same reasoning as above, one can consider them sub-objects of y
.
2
solved How to identify an object in C