[prog] C++ object creation
Sue Stones
suzo at bigpond.net.au
Wed May 28 13:05:36 EST 2003
On Wed, 28 May 2003 07:34, Kathryn Hogg wrote:
><...>
> If you have a variable declared in function, it will most likely be
> allocated on the stack for most modern machines.
><...>
> Allocating objects from the heap (aka via "new"), allows you to control
> their lifetime. They are not deallocated until you call "delete" on them.
> This is good when you need it but can lead to memory leaks if you lose
> track of pointer.
In part this answers the question that I am going to ask, but it also remids
me that I don't have a full answer.
Could some one please explain what the heap is, and also compare it to the
stack.
There is no doubt that I learnt about them years ago, but I had a breack of
nearly 10 years in my learning process, during which time I had no contact
with computers. Consequently I forgot some things, and the heap is something
that I have totally forgoten!
Thanks
sue
More information about the Programming
mailing list