Function Overloading in c++_amisobjani

Function Overriding in c++ with example.

কম্পিউটার

What is Function Overloading?

Function overloading is a feature in C++ where two or more functions can have the same name but different parameters. Function overloading is a compile-time polymorphism.

Read More: All Paragraph for HSC 

Function Overloading Example:

 

#include <iostream>
#include <stdio.h>
#include <conio.h>
using namespace std;
class Print
{
public:
int sum (int value1, int value2)
{
return value1 + value2;
}
float sub (float value1, float value2)
{
return value1 – value2;
}
string nubtk (string nub)
{
return nub;
}
};
int main()
{
Print obj;
cout << “The Summation is: “<<obj.sum(10,16) << endl;
cout << “The Subtraction is: ” <<obj.sub(26,15.75)<< endl;
cout << “NUBTK is: ” <<obj.nubtk (“Northern University of Business & Technology Khulna”)<< endl;
return 0;

}

Output: 

 

Function Overloading example in c++, 

Tagged

Leave a Reply

Your email address will not be published. Required fields are marked *