When experimenting with C ++ templates, I was able to create this simple code for which the output is different than I expected in accordance with my understanding of C ++ rules.
void bar(double d)
{
std::cout << "bar(double) function called" << std::endl;
}
template <typename T> void foo(T t)
{
bar(3);
}
void bar(int i)
{
std::cout << "bar(int) function called" << std::endl;
}
int main()
{
foo(3);
return 0;
}
V++ 2008 Express, bar(int). , , bar(3); . . , , : " ++ , , , ". , " " bar foo
void bar(double d);? , . bar.