📜  一元重载运算符 cpp - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:53.654000             🧑  作者: Mango

代码示例1
class A {
public:
    int value;
    A(int v1) : value(v1) {};
    // overloaded minus (-) operator
    A operator- () {
        return A(-value);
    };
};