#include <iostream>
class Inner
{
public:
int x;
Inner()
{
std::cout << "Inner (no params)" << std::endl;
}
Inner(int _x) : x(_x)
{
std::cout << "inner (param "<<x <<" )"<<std::endl;
}
};
class Outer
{
public:
Inner i;
Outer(Inner _i)
{
i = _i;
std::cout << "Outer" << std::endl;
}
};
class CorrectOuter
{
public:
Inner i;
CorrectOuter(Inner _i) : i (_i)
{
std::cout << "CorrectOuter" << std::endl; }
};
int main()
{
Inner i(3);
Outer o(i);
CorrectOuter co(i);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgSW5uZXIKewogIHB1YmxpYzoKICBpbnQgeDsKICBJbm5lcigpCiAgewogICAgc3RkOjpjb3V0IDw8ICJJbm5lciAobm8gcGFyYW1zKSIgPDwgc3RkOjplbmRsOwogIH0KICBJbm5lcihpbnQgX3gpIDogeChfeCkKICB7CiAgICBzdGQ6OmNvdXQgPDwgImlubmVyIChwYXJhbSAiPDx4IDw8IiApIjw8c3RkOjplbmRsOwogIH0KfTsKY2xhc3MgT3V0ZXIKewogIHB1YmxpYzoKICBJbm5lciBpOwogIE91dGVyKElubmVyIF9pKQogIHsKICAgIGkgPSBfaTsKICAgIHN0ZDo6Y291dCA8PCAiT3V0ZXIiIDw8IHN0ZDo6ZW5kbDsKICB9Cn07CmNsYXNzIENvcnJlY3RPdXRlcgp7CiAgcHVibGljOgogIElubmVyIGk7CiAgQ29ycmVjdE91dGVyKElubmVyIF9pKSA6IGkgKF9pKQogIHsKICAgIHN0ZDo6Y291dCA8PCAiQ29ycmVjdE91dGVyIiA8PCBzdGQ6OmVuZGw7ICB9Cn07CmludCBtYWluKCkKewogIElubmVyIGkoMyk7CiAgT3V0ZXIgbyhpKTsKICBDb3JyZWN0T3V0ZXIgY28oaSk7Cn0=