64,651
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
class Me
{
public:
Me();
~Me();
bool go_on(bool b);
void set_her();
private:
int Happiness;
bool continue;
bool Protection;
bool Care_for;
};
Me::Me()
{
}
Me::~Me()
{
}
bool Me::go_on(bool b)
{
continue = b;
}
void Me::make_her()
{
Protection = true;
Care_for = true;
}
class You
{
public:
You();
~You)();
void together_with_me();
bool getWilling();
private:
bool Yes;
}
You::You()
{
}
You::~you()
{
}
void You::together_with_me()
{
char ch;
cout<<"Plase Enter Y / N "<<end;
cin>>ch;
if(ch == 'Y')
Yes = true;
else Yes = false;
}
bool You::getWilling()
{
return Yes;
}
int main()
{
Me * me;
me = new Me;
You * you;
you = new You;
you->together_with_me();
if( you->getWilling())
{
me->go_on(true);
me->make_her();
}
else
me->go_on(false);
system("pause");
return 0;
}