#include<iostream>
using namespace std;
#include <string.h>
class person
{
public:
person(string name, int age)
{
m_name = name;
m_age = age;
}
bool operator==(person& p)
{
if (this->m_name == p.m_name && this->m_age == p.m_age)
{
return true;
}
return false;
}
bool operator!=(person& p)
{
if (this->m_name == p.m_name && this->m_age == p.m_age)
{
return false;
}
return true;
}
string m_name;
string m_age;
};
void test01()
{
person p1("ZZ",20);
person p2("ddd",5);
if (p1 == p2)
{
cout << "p1=p2" << endl;
}
else
{
cout << "p1!=p2" << endl;
}
if (p1 != p2)
{
cout << "p1!=p2" << endl;
}
else
{
cout << "p1=p2" << endl;
}
}
int main()
{
test01();
system("pause");
return 0;
}