DEV Community

Chhavi Joshi
Chhavi Joshi

Posted on

Function overloading

So as we know function overloading is a type of compile time polymorphism in which we have different functions with same name, and they perform different tasks. Following is code for the same, continuing yesterday's oops code:

Image description

This was how functions with same name were made and below is how they are called.

Image description

It is necessary that we keep in mind while performing polymorphism through function overloading that one of the following things must be different among the functions:

  • there return type
  • type of parameter
  • no. of parameters passed

Top comments (0)