C++ Overloading

tutorial and example
tutorial and example

C++ Overloading is a condition when two or more members have same name with different parameter type or different number of parameter. C++ overloading is two types:

  1. Function overloading
  2. Operator overloading

C++ Function Overloading

When two or more function having same name are different in their parameter is called function overloading.

C++ Function Overloading Example

This example calculates area of two different polygon.

Output:

C++ Operator Overloading

C++ provides functionality to redefine or overload the existing operators in C++. Operator overloading is used to perform operation on user define data type.

C++ Operator Overloading Example

Output: