Monday, 8 June 2015

Program of that provides an example of function overloading


Code for Program of that provides an example of function overloading in C++ Programming



 



# include <iostream.h>
# include <conio.h>

main()
{
    void f();
    void f(int a,int b=20);
    void f(int a,float c=20.9);
    int i;
    float b=67.8;
    clrscr();
    f();
    f(10,40);
    f(90,b);
}

void f()
{
    cout<<"THIS IS A EXAMPLE OF FUNCTION OVERLOADING"<<endl;

}

void f(int a=10,int b=20)
{
    cout<<"THE ADDITION IS:->"<<a+b<<endl;
}
void f(int a=90,float c=20.9)
{
    cout<<"THE ADDITION IS:->"<<a+c<<endl;
}
 

No comments:

Post a Comment