64,654
社区成员
发帖
与我相关
我的任务
分享
//Function for testing if a constant is > a CBox object
bool operator>(const double& value, const CBox& aBox)
{
return value>aBox.Volume();
}
//Function for testing if a constant is < a CBox object
bool operator<(const double& value, const CBox& aBox)
{
return value<aBox.Volume();
}
//根据刚刚定义的两个函数,可以实现参数位置互换的>和<运算符
//Function for testing if CBox object is > a constant
bool operator>(const CBox& aBox, const double& value)
{
return value<aBox;
// 这里为什么不是 return value<aBox.Volume();
}
//Function for testing if CBox object is < a constant
bool operator<(const CBox& aBox, const double& value)
{
return value>aBox;
//为什么不是 return value>aBox.Volume();
}