|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
# include <iostream>
# include <string>
class Lovers
{
public:
std::string name;
Lovers(std::string thename);
void kiss(Lovers *lover);
void ask();
};
Lovers::Lovers(std::string thename)
{
name = thename;
}
void Lovers::kiss(Lovers *lover)
{
std::cout<<name<<"亲了一下"<<lover->name;
}
class Boyfirend : public Lovers
{
public:
Boyfirend(std::string thename);
void kiss(Lovers *love);
};
void Boyfirend::kiss(Lovers *lover)
{
}
Boyfirend::Boyfirend(std::string thename) : Lovers(thename)
{
}
class Girlfirend : public Lovers
{
public:
Girlfirend(std::string thename);
};
Girlfirend::Girlfirend(std::string thename) : Lovers(thename)
{
}
int main(void)
{
Lovers * pt = new Boyfirend();
return 0;
} |
|