Functions differ in number of parameters
#include <iostream>
using namespace std;
int myFunction(int i);
int myFunction(int i, int j);
int main()
{
cout << myFunction(10) << " "; // calls myFunction(int i)
cout << myFunction(4, 5); // calls myFunction(int i, int j)
return 0;
}
int myFunction(int i)
{
return i;
}
int myFunction(int i, int j)
{
return i*j;
}
Related examples in the same category