Hello all,
My understanding is that the Objects created are stored in the heap segment.
What if the objects are created for a class with static data members?
Do the static data alone reside in the data segment, while the rest of the members are allocated on the heap?
I read somewhere the following
(when object is created inside a block in the main fn):
"When the block is exited, an object's destructor gets called (because objects on the stack are destroyed automatically when their scope ends)". This implies that the object contents are stored on the stack.
Could someone resolve this contradiction?