Use of unary plus operator

前端 未结 4 1258
抹茶落季
抹茶落季 2021-01-04 19:09

I\'ve heard it is used as overloaded operator+ for example

class MyClass
{
    int x;
public:
    MyClass(int num):x(num){}
    MyClass operator+(const MyCla         


        
4条回答
  •  别那么骄傲
    2021-01-04 19:34

    That's a binary + operator. To overload the unary plus operator, you'd need something like this.

提交回复
热议问题