Overloading Function Example
#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