Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Function Overloading in C++

  • Difficulty Level : Easy
  • Last Updated : 17 Jun, 2021

Function overloading is a feature of object oriented programming where two or more functions can have the same name but different parameters.

When a function name is overloaded with different jobs it is called Function Overloading.

In Function Overloading “Function” name should be the same and the arguments should be different.

Function overloading can be considered as an example of polymorphism feature in C++.

Following is a simple C++ example to demonstrate function overloading.


#include <iostream>
using namespace std;
void print(int i) {
  cout << " Here is int " << i << endl;
void print(double  f) {
  cout << " Here is float " << f << endl;
void print(char const *c) {
  cout << " Here is char* " << c << endl;
int main() {
  return 0;


Here is int 10 
Here is float 10.1 
Here is char* ten

How  Function Overloading works?

  • Exact match:- (Function name and Parameter)
  • If a not exact match is found:

               ->Char, Unsigned char, and short are promoted to an int.

               ->Float is promoted to double

  • If no match found:

               ->C++ tries to find a match through the standard conversion.

  1. Function overloading and return type
  2. Functions that cannot be overloaded in C++
  3. Function overloading and const keyword
  4. Function Overloading vs Function Overriding in C++

Recent articles on function overloading in C++
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!