Programming Code Center(PCC)
[CPP]

(PCC)::[How-to-write-CPP-Program-to-Increment-and-Decrement-Operator-Overloading-in-CPP-Programming]::[cpp]

File Name : Increment_Decrement_Overloading.cpp

//Example : Prefix ++ Increment Operator Overloading with no return type
#include <iostream>
using namespace std;

class Check
{
    private:
       int i;
    public:
       Check(): i(0) {  }
       void operator ++() 
          { ++i; }
       void Display() 
          { cout << "i=" << i << endl; }
};

int main()
{
    Check obj;

    // Displays the value of data member i for object obj
    obj.Display();

    // Invokes operator function void operator ++( )
    ++obj; 
  
    // Displays the value of data member i for object obj
    obj.Display();

    return 0;
}

Output :

Increment_Decrement_Overloading.jpg