//4.5.5 ��ϵ��������� //���� �� ���ع�ϵ������������������Զ������Ͷ�����жԱȲ��� #if(0) #include <iostream> class Person { public: Person(std::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; } std::string m_Name; int m_Age; }; void test01() { Person p1("Tom", 18); Person p2("Tom", 18); if (p1 == p2) { std::cout << "p1 �� p2����ȵ�" << std::endl; } else { std::cout << "p1 �� p2�Dz���ȵ�" << std::endl; } if (p1 != p2) { std::cout << "p1 �� p2�Dz���ȵ�" << std::endl; } else { std::cout << "p1 �� p2����ȵ�" << std::endl; } } int main() { test01(); system("pause"); return 0; } #endif