Why does the compiler not find the base class function signature? Changing foo( a1 )
to B::foo( a1 )
works.
Code:
class A1 ;
class A2 ;
class B
{
public:
void foo( A1* a1 ) { a1 = 0 ; }
} ;
class C : public B
{
public:
void foo( A2* /*a2*/ )
{
A1* a1 = 0 ;
foo( a1 ) ;
}
} ;
int main()
{
A2* a2 = 0 ;
C c ;
c.foo( a2 ) ;
return 0 ;
}
Compiler error (VS2008):
error C2664: 'C::foo' : cannot convert parameter 1 from 'A1 *' to 'A2 *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast