Hi,
Can anyone explain to me why is this not working. This is suppose to be an example of function overload and as far as i got it , as long as i have something (number of variables, type ...) that can distinguish my two finctions i should be ok. but ...
i get the following error:Code:using namespace std;
#include <iostream>
void print(char &x){
cout << x <<endl;
}
void print(int x){
cout << x <<endl;
}
int main(){
int x = 7;
char k[]="look at me :)";
print(k);
print(x);
return 0;
}
13.cpp: In function ‘int main()’:
13.cpp:15:10: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive]
13.cpp:8:6: error: initializing argument 1 of ‘void print(int)’ [-fpermissive]