/*C++ program for unary increment (++) and decrement (--) operator overloading.*/
 
#include<iostream>
using namespace std;
 
class STUDENT
{
    private:
        int num;
         
    public:
	  string StuName, StuFamily;
	  int StuId;
        //function to get number
        void getNum(int x)
        {
            num = x;
        }
        //function to display number
        void dispNum(void)
        {
            cout << "value of num is: " << num;
        }
        //unary ++ operator overloading
        void operator ++ (void)
        {
            num = ++num;
        }
        //unary -- operator overloading
        void operator -- (void)
        {
            num = --num;
        }
};
int main()
{
    STUDENT stu;
    stu.getNum(10);
     
    ++stu;
    cout << "After increment - ";
    stu.dispNum();
    cout << endl;
     
    --stu;
    cout << "After decrement - ";
    stu.dispNum();
    cout << endl;
    return 0;
}

