City Suvidha...your one stop Search

C++ Programs

Go Back to List

Program to implement operator overloading : ++ operator

 


#include<iostream.h>
#include<conio.h>

class student
{
private:
int rollno;

public:
student()
{
rollno=0;
}

void operator++()
{
rollno=rollno + 5;
}

void show()
{
cout<<"roll no is: "<<rollno;
}

};


void main()
{
clrscr();
student s1;
s1++;
s1.show();
}
 

Output:


roll no is: 5

 

If any of you want  to submit your programs and contribute to site please mail us at:

citysuvidha@gmail.com

  Click here to have a look at  List of programs

You can download all the programs in a zip file also. For this you have to do one thing. Just register at the citysuvidha forum  and start any thread of any topic.  Once you start the thread and put your request, admin will automatically send you the desired zip file.