Input Output Operator Overloading in C++

In this tutorial we will study and understand the Input Output Operator Overloading in C++ concept and also see a program example of the same.

Input Output Operator Overloading in C++

Input Output Operator Overloading in C++

C++ is able to input and output the built-in data types using the stream extraction operator >> and the stream insertion operator <<. The stream insertion and stream extraction operators also can be overloaded to perform input and output for user-defined types like an object.
Here, it is important to make operator overloading function a friend of the class because it would be called without creating an object.

Program example of Input(>>)Output(<<) Operator Overloading in C++

Run Online

Output
Enter the value of object :
70
10
First Distance : F : 11 I : 10
Second Distance :F : 5 I : 11
Third Distance :F : 70 I : 10

Leave a Reply

Your email address will not be published. Required fields are marked *