Destructors and containers
-
Hi there, I would like to know if I can call the destuctor explicitly in case of containership. Lets consider an example: class A { public: ~A() { cout <<"~A()"<
-
Hi there, I would like to know if I can call the destuctor explicitly in case of containership. Lets consider an example: class A { public: ~A() { cout <<"~A()"<
There's no need of calling the destructor of A explicitly. Since the object of class A is being created in B, after the destructor of B get's called the destructor of class A is also called. #include using namespace std; class A { public: ~A() { cout <<"~A()"<Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Hi there, I would like to know if I can call the destuctor explicitly in case of containership. Lets consider an example: class A { public: ~A() { cout <<"~A()"<
Raj Prathap wrote:
In the above case should the destructor of A be called explictly? If I dont call, the destructor for A is never called. Thanks in advance, Pratap Reddy
No, It will be called before B's d'tor.
Prasad Notifier using ATL | Operator new[],delete[][^]
-
There's no need of calling the destructor of A explicitly. Since the object of class A is being created in B, after the destructor of B get's called the destructor of class A is also called. #include using namespace std; class A { public: ~A() { cout <<"~A()"<Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
Thanks a lot
-
Hi there, I would like to know if I can call the destuctor explicitly in case of containership. Lets consider an example: class A { public: ~A() { cout <<"~A()"<
Raj Prathap wrote:
In the above case should the destructor of A be called explictly?
No. It will happen automatically when the
A
object goes out of scope.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb