Please i'm confused help he

Jan 30, 2013 at 10:49am
Is it possible to define two functions as given below
func(int x, int y)
func(int &x, int &y)
Jan 30, 2013 at 10:58am
closed account (9y8C5Di1)
Yes, it's called function overloading.
Jan 30, 2013 at 10:59am
closed account (9y8C5Di1)
Actually, no, you cannot do that. Because the compiler won't know which function to call. However, if you used pointers on the second function it would work.

1
2
func(int x, int y)
func(int*x, int*y)


int main(){
int x,y;func(x,y);func(&x,&y);
return 0;}
Last edited on Jan 30, 2013 at 11:05am
Topic archived. No new replies allowed.