#include <iostream>
using namespace std;
class MyParentClass {
public:
MyParentClass (int x=0) : MyInt(x) {}
int MyInt;
};
class MyChildClass : public MyParentClass
{
public:
MyChildClass () = default;
MyChildClass (int x) : MyParentClass(x) {}
MyChildClass (const MyParentClass& x) : MyParentClass(x) {}
};
int main() {
MyParentClass p = 10;
MyChildClass c = 5;
MyChildClass d = p;
cout << c.MyInt <<endl;
cout << d.MyInt <<endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKICAgIGNsYXNzIE15UGFyZW50Q2xhc3MgewogICAgcHVibGljOiAKICAgICAgICBNeVBhcmVudENsYXNzIChpbnQgeD0wKSA6IE15SW50KHgpIHt9CiAgICAgICAgaW50IE15SW50OwogICAgfTsKICAgIAogICAgY2xhc3MgTXlDaGlsZENsYXNzIDogcHVibGljIE15UGFyZW50Q2xhc3MKICAgIHsKICAgIHB1YmxpYzogCiAgICAgICAgTXlDaGlsZENsYXNzICgpID0gZGVmYXVsdDsgCiAgICAgICAgTXlDaGlsZENsYXNzIChpbnQgeCkgOiBNeVBhcmVudENsYXNzKHgpIHt9CiAgICAgICAgTXlDaGlsZENsYXNzIChjb25zdCBNeVBhcmVudENsYXNzJiB4KSA6IE15UGFyZW50Q2xhc3MoeCkge30gICAgCiAgICB9OwoKaW50IG1haW4oKSB7CglNeVBhcmVudENsYXNzIHAgPSAxMDsgCglNeUNoaWxkQ2xhc3MgYyA9IDU7IAoJTXlDaGlsZENsYXNzIGQgPSBwOwoJY291dCA8PCBjLk15SW50IDw8ZW5kbDsgCgljb3V0IDw8IGQuTXlJbnQgPDxlbmRsOyAKCQoJcmV0dXJuIDA7Cn0=