Overview of C++ Overloading: Add (Int, Long) and Add (Long, Int) Have
Overview of C++ Overloading: Add (Int, Long) and Add (Long, Int) Have
Example
5 using std::cout; different parameters
6 using std::endl;
7
8 int square( int x ) { return x * x; }
9
10 double square( double y ) { return y * y; }
11
12 int main()
13 {
14 cout << "The square of integer 7 is " << square( 7 )
15 << "\nThe square of double 7.5 is " << square( 7.5 )
16 << endl;
17
18 return 0;
19 }
Example
#include<iostream.h>
float f(float i)
{ return i/2.0; }
double f(double i)
{ return i/3.0; } (contd..)
Example(contd..)
int main()
{
float x=4.0;
double y=5.0;