#include <iostream>
class X {
public:
X() {
std::cout << "an object of type X gets default-constructed"
<< std::endl;
}
~X() {
std::cout << "an object of type X gets destructed" << std::endl;
}
};
class Y {
public:
Y() {
std::cout << "an object of type Y gets default-constructed"
<< std::endl;
}
~Y() {
std::cout << "an object of type Y gets destructed" << std::endl;
}
};
class Z {
public:
Z() {
std::cout << "an object of type Z gets default-constructed"
<< std::endl;
}
~Z() {
std::cout << "an object of type Z gets destructed" << std::endl;
}
private:
X x;
Y y;
};
int main() {
Z z;
}