Big operator+(const Big & lhs, const int & rhs) { std::cout << "*****在operator+里*****" << std::endl; Big b(lhs); b.setX(lhs.getX() + rhs); b.setY(lhs.getY() + rhs); std::cout << "*****operator+完成*****" << std::endl; return b; }//operator+(Big, int)
void print(const Big & b) { std::cout << "x=" << b.getX() << std::endl << "y=" << b.getY() << std::endl << "name=" << b.getName() << std::endl << std::endl; }//print(Big)