class a { public int Num{get;set;} //重载运算符 + public static a oprator +(a a1,a a2) { a2.Num+=a1.Num; return a2; } } a a1=new a(){Num=10}; a a2=new a(){Num=20}; a a3=a1+a2; console.writeLine(a3.Num);
输出结果为:30
class a { public int Num{get;set;} //重载运算符 + public static a oprator +(a a1,a a2) { a2.Num+=a1.Num; return a2; } } a a1=new a(){Num=10}; a a2=new a(){Num=20}; a a3=a1+a2; console.writeLine(a3.Num);
输出结果为:30