K
kazack
I know that this is possible and I now how it is possible.
But why would you want to call more than one function the same name to begin
with? Wouldn't it be just easier to call them 2 different names?
Ex.
#include <string>
#include <iostream>
//why not integer_print and string_print??????
void print(int);
void print(string);
int main()
{
string name = "test";
int a = 4;
print(a);
print(name);
return 0;
}
void print(string name)
{
cout << name;
}
void print(int a)
{
cout << a;
}
Thanks for the understanding.
Shawn Mulligan
But why would you want to call more than one function the same name to begin
with? Wouldn't it be just easier to call them 2 different names?
Ex.
#include <string>
#include <iostream>
//why not integer_print and string_print??????
void print(int);
void print(string);
int main()
{
string name = "test";
int a = 4;
print(a);
print(name);
return 0;
}
void print(string name)
{
cout << name;
}
void print(int a)
{
cout << a;
}
Thanks for the understanding.
Shawn Mulligan