Program to Overload ++ operator in C++ // C++ TUTORIAL
#include<upstream.h>
#include<conio.h>
class test
{
int count;
public:
test ()
{
count=5;
}
void operator ++()
{ count {count+1!
}
void display ()
{ count<<"Count :"<<count<<endl;
}
};
void main()
{ clrscr();
test t;
++t;
t.display();
getch();
}
OUTPUT:—
Count = 6
Comments
Post a Comment
Please Subscribe and Comments my blog site.