随手写的,欢迎修改补充

tan625747 tan625747 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#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;
}
...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
tan625747
C++ 语言 65,214 成员 250,514 内容