By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,332 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,332 IT Pros & Developers. It's quick & easy.

compiler generated destructor vs class implemented destructor

P: n/a
Hello Group,

The compiler generated destructor will invoke destructor of each member

of the containing
class let us say 'class A'. However, if I write my own destructor for
class A like;
class Object1 {
// code here

};
class Object2{
// code here
};
class Object3 {
// code here
};
class A{
public:
Object1 o1;
Object2 o2;
Object3 o3;
};
The question is if I have a destructor and implement it as

~A() {}
Will the objects o1, o2, o3's destructor be still invoked, when class A

goes out of scope.
Thanks
nagrik

Jun 12 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

arun wrote:
Will the objects o1, o2, o3's destructor be still invoked, when class A

goes out of scope.


Please read the replies to your questions before posting them again.
Now I feel I just totally wasted my time answering this the first time.

Jun 12 '06 #2

P: n/a
[snip]

The question is if I have a destructor and implement it as

~A() {}
Will the objects o1, o2, o3's destructor be still invoked, when class A

goes out of scope.
Yes.


Thanks
nagrik


Regards
Ben
Jun 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.