Answers for "unary overload operator cpp"

C++
0

unary overload operator cpp

class A {
public:
    int value;
    A(int v1) : value(v1) {};
    // overloaded minus (-) operator
    A operator- () {
        return A(-value);
    };
};
Posted by: Guest on February-21-2021

Browse Popular Code Answers by Language