i have a basic and simply question.
I have this scenario:
#include <iostream>
using namespace std;
class Inner1
{
public:
~Inner1() {cout << "Inner1 Des\n";};
};
class Inner2
{
public:
~Inner2() {cout << "Inner2 Des\n";};
};
class Base
{
public:
~Base() {cout << "Base Des\n";};
Inner1 inner1;
Inner2 inner2;
};
int main() {
Base base;
return 0;
}
And my console tells me now this:
Base destructor called
Inner2 destructor called
Inner1 destructor called
Is this the normal behavior? Because the functionality for some functions
is already destroyed in my Base Class destructor and the Inner classes rely on them.
Thank you for your help
Aucun commentaire:
Enregistrer un commentaire