Operator Overloading/Function Overloading Program in C++


In this tutorial we will learn about operator overloading in C++. This is a OOPS(Object Oriented Programming) feature of C++ which in not supported in C language. Operator overloading happens when we use same function name for different task. In C++ we can use same function name to perform different task. It is also called as function overloading. This is a very useful features of C++.

Operator Overloading/Function Overloading Program in C++

C++ Program To Create A Multifunctional Calculator

#include<iostream.h> #include<conio.h> class temp { private: int count; public: temp():count(10) { } void operator ++() { count=count+1; } void Display() { cout<<"Count: "<<count; } }; void main() { clrscr(); temp t; ++t; /* operator function void operator ++() is called */ t.Display(); getch(); }



Solution Worked 0 UpvotesUpvote


Solution Didn't Worked 0 DownvotesDownvote


Get Programming Help

Play 2048 Game Online

Search Tags