Operator Overloading
�C++ Overloading �(Function and Operator)�
Types of overloading in C++ �
C++ Operators Overloading�
Operator that cannot be overloaded
Syntax of Operator Overloading�
Rules for Operator Overloading�
Why Operator Overloading??
‘2 +3’,
‘obj1 = obj2 + obj3’
(where all these are objects of same class)
How + operator should work in this case?
Consider the following class:
�Overloading stream insertion (<>) operators in C++�
�1) cout is an object of ostream class and cin is an object of istream class .
�2) These operators must be overloaded as a global function. And if we want to allow them to access private data members of the class, we must make them friend.
Why these operators must be overloaded as global?