operator Overloading in C#

后端 未结 3 1526
南笙
南笙 2021-01-04 19:24
class Point
{
    private int m_PointX;
    private int m_PointY;

    public Point(int x, int y)
    {
        m_PointX = x;
        m_PointY = y;
    }

    public         


        
3条回答
  •  攒了一身酷
    2021-01-04 19:46

    To answer your questions:

    1. Yes, you need to define them as static. They're not instance methods, they can operate on nulls as well.
    2. You'll have to define an operator overload where one of the parameters are of type int

提交回复
热议问题