- In C++, polymorphism is achieved through function overloading and operator overloading
- The term overloading means a name having two or more distinct meanings.
- Overloaded function’ refers to a function having more than one distinct meaning. Overloaded functions have same name but different signatures (Number of
argument and type of argument) - A function’s argument list is known as a function signature
- Two function cannot be overloaded when the only difference is that one takes a reference parameter and the other takes a normal, call-by-value parameter.
- Ordinary functions as well member functions can be overloaded
- A class can have overloaded constructors where as destructor function cannot be overloaded.
- The mechanism of giving special meaning to an operator is known as operator overloading.
- Operator overloading provides new definitions for most of the C++ operators. Even user defined types (objects) can be overloaded.
- The definition of the overloaded operator is given using the keyword ‘operator’ followed by an operator symbol.
- We can overload all the C++ operators except the following:
Scope resolution operator (::), sizeof(), Conditional operator (?:), Member selection(.) and Member pointer selector (*) operator