/*C++ program for unary minus (-) operator overloading.*/

#include<iostream>
using namespace std;
 
class NUM
{
    private:
        int x, y;
         
    public:
        //function to get numbers
        void getNums(int a, int b)
        {
            x = a;
	      y = b;
        }
        //function to display number
        void dispNums(void)
        {
            cout << "value of x is: " << x << endl;
            cout << "value of y is: " << y << endl;
        }
        //unary - operator overloading
        void operator - (void)
        {
            x = -x;
            y = -y;
        }
};

int main()
{
    NUM num;
    num.getNums(10, -9);
    -num;
    num.dispNums();
    return 0;
}

