Operator Overloading/Function Overloading Program in C++

[1036 views]


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(); }

Output

11
        

Struggling to Understand Algorithm and Flowchart? Try our Notes



Want to Test Your Knowledge on Algorithm and Flowchart?



Comments



Recommended Deals End in



Search
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Search Tags