![]() |
|
#1
|
|||
|
|||
Contructors and destructors problemHi,
I the below code i could see 2 constructors and 3 destructors being called....i want to know why....can anyone help me in knowing this??? CPP / C++ / C Code:
Last edited by LuciWiz : 17-Sep-2007 at 13:50.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|
|
#2
|
|||
|
|||
Re: Contructors and destructors problemIn C++, unlike in some languages, objects are not automatically passed by reference. So the function
CPP / C++ / C Code:
Since your class doesn't define a copy constructor, you don't get notified of the object's construction. Try adding this to your class: CPP / C++ / C Code:
Find a book or some online reference about classes, they should tell you about why and when you need a copy a constructor and an assignment operator. |
Recent GIDBlog
Last Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The