重载运算符
class Complex{
    public int Number{get;set;}
    public static Complex operator +(Complex a,Complex b){
        Complex c = new Complex();
        c.Number = a.Number+b.Number;
        return c;
    }
}

重载+,可以使用类与类直接相加


首页 我的博客
粤ICP备17103704号