当 2 个对象相加时是没有顺序要求的,但要重载 + 让其与一个数字相加则有顺序要求,可以通过加一个友元函数使另一个顺序的输入合法。 #include<iostream> using namespace std; class A { private: int a; public: A(); A(int n); A operator+(const A & obj); A operator+(const int b); friend A operator+(const int b, A obj); void display(); } ; A::A() { a=0; } A::A...