Program to illustrates Function Overloading


          #include <iostream.h>
          // Function prototypes
          int add (int, int);                             
          float add (float, float, float);
    void main( )
    {
            int a=5, b=10;
            float c=4.5, d=2.5, e=8.7;
            cout << " First addition result = " << add (a,b);
            cout << "\n Second addition result = " << add (c,d,e);
    }

    int add (int p, int q)
    {
            return (p+q);
    }

    float add (float p, float q, float r)
    {
            return (p+q+r);
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|