#include <iostream>
class airship
{
public:
unsigned int nPerson;
unsigned int nWeight;
void Show()
{
printf("person: %d, weight: %d\n", nPerson, nWeight);
}
};
class airplane : airship
{
public:
bool bPropeller;
float nDistance;
void Show()
{
printf("person: %d, weight: %d, type: %s, distance: %f\n", nPerson, nWeight, bPropeller ? "Propeller" : "Jet", nDistance);
}
};
class baloon : airship
{
public:
unsigned int bHydrogen;
unsigned int nMaxAltitude;
void Show()
{
printf("person: %d, weight: %d, fuel: %s, max-altitude: %d\n", nPerson, nWeight, bHydrogen ? "Hydrogen" : "Helium", nMaxAltitude);
}
};
int main()
{
airship s = airship();
airplane p = airplane();
baloon b = baloon();
s.Show();
p.Show();
b.Show();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgYWlyc2hpcAp7CnB1YmxpYzoKCXVuc2lnbmVkIGludCBuUGVyc29uOwoJdW5zaWduZWQgaW50IG5XZWlnaHQ7Cgl2b2lkIFNob3coKQoJewoJCXByaW50ZigicGVyc29uOiAlZCwgd2VpZ2h0OiAlZFxuIiwgblBlcnNvbiwgbldlaWdodCk7Cgl9Cn07CgpjbGFzcyBhaXJwbGFuZSA6IGFpcnNoaXAKewpwdWJsaWM6Cglib29sIGJQcm9wZWxsZXI7CglmbG9hdCBuRGlzdGFuY2U7Cgl2b2lkIFNob3coKQoJewoJCXByaW50ZigicGVyc29uOiAlZCwgd2VpZ2h0OiAlZCwgdHlwZTogJXMsIGRpc3RhbmNlOiAlZlxuIiwgblBlcnNvbiwgbldlaWdodCwgYlByb3BlbGxlciA/ICJQcm9wZWxsZXIiIDogIkpldCIsIG5EaXN0YW5jZSk7Cgl9Cn07CgpjbGFzcyBiYWxvb24gOiBhaXJzaGlwCnsKcHVibGljOgoJdW5zaWduZWQgaW50IGJIeWRyb2dlbjsKCXVuc2lnbmVkIGludCBuTWF4QWx0aXR1ZGU7Cgl2b2lkIFNob3coKQoJewoJCXByaW50ZigicGVyc29uOiAlZCwgd2VpZ2h0OiAlZCwgZnVlbDogJXMsIG1heC1hbHRpdHVkZTogJWRcbiIsIG5QZXJzb24sIG5XZWlnaHQsIGJIeWRyb2dlbiA/ICJIeWRyb2dlbiIgOiAiSGVsaXVtIiwgbk1heEFsdGl0dWRlKTsKCX0KfTsKCmludCBtYWluKCkKewoJYWlyc2hpcCBzID0gYWlyc2hpcCgpOwoJYWlycGxhbmUgcCA9IGFpcnBsYW5lKCk7CgliYWxvb24gYiA9IGJhbG9vbigpOwoJcy5TaG93KCk7CglwLlNob3coKTsKCWIuU2hvdygpOwoJcmV0dXJuIDA7Cn0K