Definition some_class:
class some_class
{
public:
~some_class()
{
delete dynamic_three;
}
private:
classA one;
classB two;
classC* dynamic_three;
}
When the lifetime of an object ends, its destruction: (1) calls its destructor and (2) destroys its subobjects in the same order in which they are declared in the class definition (= position in memory).
But if I have something like this:
auto* ptr = new some_class();
ptr->~some_class();
Also step (2) is implemented? I mean, in line X, are destructors of subobjects also called, or are they just executing the body of the destructor some_class?
source
share