#include <string>
#include <iostream>
using namespace std;
class priceName
{
public:
string getName()
{
return name;
}
double getPrice()
{
return price;
}
void setName(string i)
{
this->name=i;
}
void setPrice(double i)
{
this->price=i;
}
private:
string name;
double price;
};
class iFood
{
public:
iFood(string i, double j)
{
pn.setName(i);
pn.setPrice(j);
}
void show()
{
cout<<pn.getName()<<" : "<<pn.getPrice()<<endl;
}
private:
priceName pn;
};
class iDrink
{
public:
iDrink(string i, double j)
{
pn.setName(i);
pn.setPrice(j);
}
void show()
{
cout<<pn.getName()<<" : "<<pn.getPrice()<<endl;
}
private:
priceName pn;
};
int main(void)
{
iFood food("apple",0.99);
iDrink drink("coke",1.99);
food.show();
drink.show();
return(0);
}
I2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNsYXNzIHByaWNlTmFtZQp7CnB1YmxpYzoKICAgIHN0cmluZyBnZXROYW1lKCkKICAgIHsKICAgICAgICByZXR1cm4gbmFtZTsKICAgIH0KICAgIGRvdWJsZSBnZXRQcmljZSgpCiAgICB7CiAgICAgICAgcmV0dXJuIHByaWNlOwogICAgfQogICAgdm9pZCBzZXROYW1lKHN0cmluZyBpKQogICAgewogICAgICAgIHRoaXMtPm5hbWU9aTsKICAgIH0KICAgIHZvaWQgc2V0UHJpY2UoZG91YmxlIGkpCiAgICB7CiAgICAgICAgdGhpcy0+cHJpY2U9aTsKICAgIH0KcHJpdmF0ZToKICAgIHN0cmluZyBuYW1lOwogICAgZG91YmxlIHByaWNlOwp9OwoKY2xhc3MgaUZvb2QKewpwdWJsaWM6CiAgICBpRm9vZChzdHJpbmcgaSwgZG91YmxlIGopCiAgICB7CiAgICAgICAgcG4uc2V0TmFtZShpKTsKICAgICAgICBwbi5zZXRQcmljZShqKTsKICAgIH0KICAgIHZvaWQgc2hvdygpCiAgICB7CiAgICAgICAgY291dDw8cG4uZ2V0TmFtZSgpPDwiIDogIjw8cG4uZ2V0UH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