+ 3
Constructor and Destructor
Is it possible for a constructor and destructor to call each other in C++? any example?
2 ответов
+ 5
Technically no. In C++, both the constructor and destructor are programmer defined to manage the life cycle of an object. For a destructor to be called, an object of the class must have been instantiated.
+ 1
if you call destructor inside of constructor, what would you return from it?
if you call constructor from destructor, how would you free up memory? I mean: you destroy an instance while you create (ar least) another one ^^