Skip to main content

Function Overloading in C++

        Function Overloading

Definition:

  • In Function Overloading there are more than one functions with same name but different Parameters.
  • This is Also called Static Isomorphism
  • This is Also known as Compile time binding.
  • In this the methods name will be same with different signature.

Example:

int add(int a, int b); int add(int a, int b, int c); void add(int a, float b, double c, int d);

Program


#include <iostream>
using namespace std;
int add(int n1, int n2)
{
    int res;
    res = n1+n2;
    cout<<"\n Addition :\n"<<n1<<" + "<<n2<<" = "<<res;
}
int add(int n1,float n2, int n3)
{
    float res;
    res = n1+n2+n3;
    cout<<"\n Addition :\n"<<n1<<" + "<<n2<<" + "<<n3<<" = "<<res;
}
int main()
{
    add(10,20);
    add(10.33,22.3,44.44);
    return 0;
}

Comments

Popular posts from this blog

Programming Basics

Logic Building Data_Types Operators Algorithms Pseudo_Code Hello Guys, Let's Play with Logic.........but wait, before that you must know that how to build Logic in Programming as you all know that programming is all about Logic..... So Let's start the game... If you are new Here that means you are absolutely right Place, Or If you already know, than you will learn new things here! If we Talk about the Programming we should be familiar with  these terms..... 1. Variable 2. Data Types 3.Keywords Variable: Variable is something which holds the value.                  Like:      a=10;                 Here,                 a---------------------->  Variable                  10 ---------------------> Value * The Value of Variable can be changed , *  ...

FAQs

Basic Questions on Programming Languages 1. What is the meaning of Programming? Ans: Programming is the process of Scheduling the task to perform step by step to Execute a specific Task. 2. Types of Programming Languages? Ans: Types:             Procedural Programming Language            Object Oriented Programming Language            Object Based Language            Scripting Language Procedural Programming Language   C Programming  Object Oriented Programming Language     C++     Java     C#     VB.Net Object Based Language     JavaScript Scripting Language     Python     VBScript     PHP     Perl     Ruby     R 3. Types Of Operators in Programming Languages. Ans:      Operators Symbols Type Example Assignment = U...