64,661
社区成员
发帖
与我相关
我的任务
分享
struct FIELD_TYPE_BOOL
{
bool one;
bool two;
bool three;
bool four;
bool five;
FIELD_TYPE_BOOL():one(false),two(false),three(false),four(false),five(false){}
void operator = (bool statu){
this->one = statu;
this->two = statu;
this->three = statu;
this->four = statu;
this->five = statu;
}
};
int main()
{
struct FIELD_TYPE_BOOL Operate;
Operate = false;
if(Operate.one)
cout << "one is true" << endl;
else
cout << "one is false" << endl;
return 0;
}
int main()
{
struct FIELD_TYPE_BOOL *pOperate = new struct FIELD_TYPE_BOOL ;
// struct FIELD_TYPE_BOOL Operate;
// Operate = false;
/**用结构体指针我该如何调用重载的操作符呢?**/
if(pOperate->one)
cout << "one is true" << endl;
else
cout << "one is false" << endl;
return 0;
}