#include<iostream>
#include<string.h>
using namespace std;
class String{
public:
int a;
String &operator + (const String &rhs);
String(int b){
a=b;
}
};
String &String :: operator+(const String &rhs){ //重载加法运算
cout<<"a+b"<<endl;
return *this;
}
int main(){
String a(1);
String b(2);
a+b;
return 0;
}
转载于:https://www.cnblogs.com/quan1/p/6696199.html