Let's say I have the following program:
template <class X> void foo(X val) { }
template <> void foo<double>(double val) { }
class obj
{
public:
void callFoo() { foo(7.3); }
private:
void foo(int val) { }
};
int main()
{
obj o;
o.callFoo();
}
Why the foo(int val)
is chosen?
Doesn't it supposed to be the foo<double>(double val)
?
I thought maybe the class scope caused the foo(int val)
to be called.