-2

Possible Duplicate:
How are objects stored in memory in C++?

Hello All,

I am improving the question a bit. I was asked a c++ question about, how the c++ objects are stored in memory when created a object using stack memory and dynamic memory.

When object is created in heap, the automatic variables in class i.e like POD data types. memory will be destroyed after deleting the object. or any different behavior ?

Please provide your comments.

Thanks

Community
  • 1
  • 1

2 Answers2

0

The best I can find out quickly is this one, Have a look in similar discussion here. . . . Following is a pictorial representation of how class objects are stored in the memory,

In this example small is an object which contains the labelObject, enter image description here

Community
  • 1
  • 1
Amit
  • 13,134
  • 17
  • 77
  • 148
  • as I search I see that their are so many similar questions here on SO... have a look on related questions here - - - >>>> "under the related link, at the bottom right of this page".. – Amit Mar 20 '12 at 07:51
  • I don't quite see what this is supposed to represent... a UML diagram perhaps ? It certainly does *not* look like anything C++ish. – Matthieu M. Mar 20 '12 at 07:56
  • Yes, this bears no relation to the question. – David Heffernan Mar 20 '12 at 08:10
0

This book will help - "Inside the C++ Object Model"

http://www.amazon.com/Inside-Object-Model-Stanley-Lippman/dp/0201834545

Sanish
  • 1,699
  • 1
  • 12
  • 21