Interesting ... I get the same problem when compiling the code with GCC.
If you change line 30 to d.base::write( "one", "two", "three" ); it will "work".
EDIT: Some googling and I found that if you add using base::write; to the derrived class definition in your code it also works. I'm not sure why it has to be done this way.
The reason is the good old ugly information hiding concept of C/C++. write in the derrived class hides consequently all write functions in the base class
> write in the derrived class hides consequently all write functions in the base class
Yes.
When a name is introduced into a nested scope, it hides that name in the outer scope. What is hidden is the name 'write'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
int name(int) { return 8 ; }
int name(double) { return -3 ; }
int main()
{
int i ;
{
i = name(45) ; // ok, ::name(int)
int name ; // ok. name hides ::name
i = name(45) ; // error - 'name' is an int, not a function
}
{
i = name(4.5) ; // overload resolves to ::name(double)
externint name(int) ; // declare name(int), hides ::name
i = name(4.5) ; // name is not overloaded; calls ::name(int)
}
}
Every declaration is declared in some declarative region. A declaration in a inner declarative region hides the declaration in an outer declarative region with the same name. For example
#include <iostream>
int a = 1;
int main()
{
std::cout << "a = " << a << std::endl;
int a = 2;
std::cout << "a = " << a << std::endl;
{
int a = 3;
std::cout << "a = " << a << std::endl;
}
std::cout << "a = " << a << std::endl;
std::cout << "::a = " << ::a << std::endl;
}
By the way your original example could be compiled if you called the function with three parameters the following way