类思维导图
条件函数的重载
#include <iostream>
using namespace std;
class complex
{
int num;
public:
complex(int num)
{
this->num=num;
}
bool operator>(complex &p)
{
return this->num>p.num;
}
};
int main()
{
complex p1(16);
complex p2(14);
int num=p1>p2;
cout<<num<<endl;
return 0;
}