Say we have the classes.
class A
{
public:
void doSomething() = 0;
A();
virtual ~A();
private:
vector<SomeStuff> cont;
bool yesNo;
}
class B: public A
{
public:
B();
~B();
private:
bool Byesno;
}
So the constructor of A gets called first and then the constructor of B gets called after that, and when we destroy B, the destructor of B gets called first and the destructor of A gets called after that. So basically, the destructor of A will delete the inherited variables of B and and the destructor of B will delete its class-specific ones. Am I right?
what I don't understand is how can we call the destructor of A if we can't even instantiate an object of type A? How does it work internally?