Operator Overloading/Function Overloading Program in C++

[5469 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
                 




Comments



Search

For any inquiry, Contact us at atechdailyweb@gmail.com




Facing Programming Errors. Get Answers within 24 hours:


Recommendation Based on your Interest




Quiz For You:
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Search Tags