Create a C++ class Number with integer data member. Write necessary member functions to overload the operator unary pre and post increment ' ++ '
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
class integer
{
int no;
public:
integer(){}
integer(int num)
{
no=num;
}
integer operator++()
{
++no;
return *this;
}
integer operator++(int) //post increment
{
integer temp=*this;
no++;
return temp;
}
void display()
{
cout<<"\nNo = "<<no;
}
};
void main()
{
integer i(10),i1(10),i3;
clrscr();
cout<<"\nAfter post increment = ";
i3=i++;
i3.display();
cout<<"\nAfter pre increment = ";
i3=++i1;
i3.display();
getch();
}