compiler generated destructor vs class implemented destructor

A

arun

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
 
N

Noah Roberts

arun said:
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.
 
B

benben

[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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top