Function Overloading In C++
Function Overloading In C++
C++ allows you to specify more than one definition for a function name or an operator in the same scope, which is called function overloading and operator overloading respectively.
Function Overloading is compile time polymorphism.
Function Overloading is the practice of declaring the same function with different signature.
same function name used with different number of parameters and parameters of different type.
Overloading of Function with different data types is not allowed.
A Function is overloaded when same name is given to the different functions.
Two functions with same name is must differ in at least one of the following.
- The data type of parameters
- The order of appearance
- Number of parameters
May You Like To Read This Related Articles:
What Is Operating System? Knowledge Of OS!!
Operating System As A User Interface And As A Resource Manager - Technopedia!
Services Of Operating System -
Technopedia!!!
Basic Concepts Of OOPC!!
CONCEPT OF DBMS!!
Types Of Operating System - Technopedia!!!
Basic Program Of C Language For Print Hello!!
#include<stdio.h>
#include<conio.h>
class maths
{
public:
void add(int num1,int num2)
{
cout<<num1+num2<<endl;
}
void add(float num1+float num2)
{
cout<<num1+num2<<endl;
}
void add(int num1+num2+num3)
{
cout<<num1+num2+num3<<endl;
}
};
int main()
{
math m;
m.add(5,10);
m.add(12.5,10.5);
m.add(1,2,3);
}
Recommend Articles For More Information :
Introduction Of C++!!.
Operators In C++
Function Overloading In C++
Data Types in C++
Types Of Constructor In C++
Classes and Objects In C++
What Is Inheritance In C++?
Types Of Inheritance?
Basic Concepts Of OOPC!!
CONCEPT OF DBMS!!
Basic Program Of C Language For Print Hello!!
15
23
6
For More Knowledge Check This Articles For Better Understanding :
Machine Learning Technology in Software Engineering
Trending Pieces Of Technology You Should Know About!!!
CONCEPT OF DBMS!!
Phases Of Compiler In System Programming!!!!
C Program For Addition, Subtraction, Multiplication, Division Of Two Numbers!!
Difference between a monolithic and micro kernel?
Difference Between The Procedure Oriented Language and Object Oriented Language.
What Is Inheritance In C++? Types Of Inheritance?
What Is Operating System? Knowledge Of OS!!
Operating System As A User Interface And As A Resource Manager - Technopedia!
Services Of Operating System -
Technopedia!!!
Basic Concepts Of OOPC!!
CONCEPT OF DBMS!!
Types Of Operating System - Technopedia!!!
Example :
#include<stdio.h>
#include<conio.h>
class maths
{
public:
void add(int num1,int num2)
{
cout<<num1+num2<<endl;
}
void add(float num1+float num2)
{
cout<<num1+num2<<endl;
}
void add(int num1+num2+num3)
{
cout<<num1+num2+num3<<endl;
}
};
int main()
{
math m;
m.add(5,10);
m.add(12.5,10.5);
m.add(1,2,3);
}
Recommend Articles For More Information :
Introduction Of C++!!.
Operators In C++
Function Overloading In C++
Data Types in C++
Types Of Constructor In C++
Classes and Objects In C++
What Is Inheritance In C++?
Types Of Inheritance?
Basic Concepts Of OOPC!!
CONCEPT OF DBMS!!
Basic Program Of C Language For Print Hello!!
output :
15
23
6
For More Knowledge Check This Articles For Better Understanding :
Machine Learning Technology in Software Engineering
Trending Pieces Of Technology You Should Know About!!!
CONCEPT OF DBMS!!
Phases Of Compiler In System Programming!!!!
C Program For Addition, Subtraction, Multiplication, Division Of Two Numbers!!
Difference between a monolithic and micro kernel?
Difference Between The Procedure Oriented Language and Object Oriented Language.
What Is Inheritance In C++? Types Of Inheritance?
Comments
Post a Comment