jbonanno icon

Overloading Function Example

jbonanno | PRO | 11/17/17 05:22:38 PM UTC | 0 ⭐ | 274 👁️ | Never ⏰ | []
C++ |

490 B

|

None

|

0 👍

/

0 👎

#include <iostream>
 
using namespace std;
 
 
 // This prints the string passed as an argument.
void display(char []);  //
void display(char [], char [], char[]);
 
int main()
{
   char one[] = "Apple";
   char two[] = "Banana";
   char three[] = "Pear";
 
   display(one);
   display(one, two, three);
 
   return 0;
}
 
void display(char a[])
{
   cout << a << endl;
}
 
void display(char a[], char b[], char c[])
{
   cout << a << endl << b << endl << c << endl;
}

Comments