|
-
January 20th, 2011, 10:44 AM
#4
Re: Objects of a class
 Originally Posted by Lindley
Keep in mind that regardless of where the object itself is created, the object or one of its members may internally use heap memory.
Can you please explain this?
Also if the object is created on stack why do we need destructor? In the main(), objects would behave as automatic variable and get destroyed automatically right before the scope of main ends. In the same manner as for any other function.
E.g.
Code:
void f()
{
double d;
}
The object d gets destroyed automatically when the scope of function is over.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|