you don't need to write the 后缀版本, the compiler takes care of the 后缀版本 for you

解决方案 »

  1.   

    public static Point operator ++ ( Point LValue )
    {
    Point newpoint = new Point();
    newpoint.x = RValue.x +1;
    newpoint.y =RValue.y +1;
    return newpoint;
    }
    LValue有何用?是不是有问题
    如下:
    public static Point operator ++ ( Point RValue )
    {
    Point newpoint = new Point();
    newpoint.x = RValue.x +1;
    newpoint.y =RValue.y +1;
    return newpoint;
    }怎么觉得是++前缀重载?public static Point operator ++ ()
    {
    this.x = this.x +1;
    this.y =this.y +1;
    return this;
    }应该是++后缀重载吧!
      

  2.   

    同意saucer(思归, MS .NET MVP),++这个东西在C#中只有一种版本。
    你重载了Point以后,
    在你重载了++操作符以后,C#编译器回用以下方式调用:Point pt = ...;
    //pt ++; 等同于
    Point temp = pt;
    pt = Point.operator ++(pt);
    return temp;// ++ pt; 等同于
    pt = Point.operator ++(pt);
    return pt;
      

  3.   

    you only need one version, see the specification:
    http://www.jaggersoft.com/csharp_standard/14.6.5.htm"......
    The ++ and --operators also support postfix notation (§14.5.9). 2 The result of x++ or x--is the value of x before the operation, whereas the result of ++x or --x is the value of x after the operation. 3 In either case, x itself has the same value after the operation. 
    Paragraph 6An operator ++ or operator --implementation can be invoked using either postfix or prefix notation.It is not possible to have separate operator implementations for the two notations. 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...."