S
Steve Pope
A very simple question follows.
Is it correct operation that the following fails to compile if
I uncomment the line indicated, and if so, what rule precludes
overloading the function foo() in the manner I am attempting
(based on type/number of operators)?
It seems unambiguous to me.
Thanks
Steve
*************************************
#include <cstdio>
struct a {
// uncommenting the following line causes it to fail to compile
// void foo(int x) { std:rintf("%d\n", 2*x); }
void do_foo();
};
namespace {
void foo(int x, int y) {std:rintf("%d\n", x + y); }
}
void a::do_foo() {
foo(2,4);
}
main() {
a y;
y.do_foo();
}
Is it correct operation that the following fails to compile if
I uncomment the line indicated, and if so, what rule precludes
overloading the function foo() in the manner I am attempting
(based on type/number of operators)?
It seems unambiguous to me.
Thanks
Steve
*************************************
#include <cstdio>
struct a {
// uncommenting the following line causes it to fail to compile
// void foo(int x) { std:rintf("%d\n", 2*x); }
void do_foo();
};
namespace {
void foo(int x, int y) {std:rintf("%d\n", x + y); }
}
void a::do_foo() {
foo(2,4);
}
main() {
a y;
y.do_foo();
}