#include<iostream>
using namespace std;
class Increment{
private:
int x;
public:
Increment(int i){
x= i;
}
void operator ++(){
x= x+2;
}
void display(){
cout<<x<<endl;
}
};
int main(){
Increment in(9);
in.display();
++in;
in.display();
}
Comments
Leave a comment