#include <iostream>
using namespace std;
class stu
{
//private:
//int nAge;//一般数据成员都是私有的,赋值运算符的类内重载的权限可以写成private。
public:
int nAge;//赋值运算符的类外重载一般都需要权限public
stu()
{
nAge = 0;
}
int operator =( int a)
{
nAge = a;
return nAge;
}
int& operator +=( int a)
{
nAge = nAge + a;
return nAge;
}
};
//void operator +=(stu& db1,int a)
//{
// db1.nAge = db1.nAge+a;
// //return nAge;
//}
//stu& operator +=(stu& db1, int a)
//{
// db1.nAge = db1.nAge + a;
// return db1;
//}
//int& operator +=(stu& db1, int a)
//{
// db1.nAge = db1.nAge + a;
// return db1.nAge;
//}
int main()
{
stu db;
cout<<(db = 123)<<endl;
stu db1;
int a = 1233;
//db1+= a+=1233;
//cout << db1.nAge << endl;
//db1+= a+=1233;
//cout << db1.nAge ;
cout << (db1 += a += 1233 );
system("pause");
return 0;
}