How does operator overloading of true and false work?

前端 未结 3 996
清酒与你
清酒与你 2020-12-06 11:53

You can overload operator true and false i looked at examples and found this http://msdn.microsoft.com/en-us/library/aa691312%28v=vs.71%29.aspx

I completely dont und

3条回答
  •  情深已故
    2020-12-06 12:11

    You will need to override & operator for && and | or ||.

    Somthing like this: (Just a dummy code)

    public static MyTimeSpan operator &(MyTimeSpan t, MyTimeSpan s) { return t; }
    
    public static MyTimeSpan operator |(MyTimeSpan t, MyTimeSpan s) { return t; }
    

提交回复
热议问题