关系操作符重载: //相等操作:判断二人学号是否相等
bool operator==(const Student& std1,const Student& std2)
{
return std1.schoolNumber == std2.schoolNumber&&
std1.name == std2.name&&
std1.address == std2.address;
}
//利用相等判断不等
bool operator!=(const Student& std1,const Student& std2)
{
return std1 == std2;
}
//重载小于操作符:判断学号大小
bool operator<(const Student& std1,const Student& std2)
{
return std1.schoolNumber < std2.schoolNumber;
}
//重载大于操作符:利用小于判断大于
bool operator>(const Student& std1,const Student& std2)
{
return std2<std1;
}