#include <iostream>
class Base
{
public:
virtual void ok( float k ){ std::cout<< "ok..." << k; }
virtual float ok(){ std::cout<< "ok..."; return 42.0f; }
};
class Test : public Base
{
public:
void ok( float k ) { std::cout<< "OK! " << k; }
//float ok() { std::cout << "OK!"; return 42; }
};
int main()
{
Test test;
float k= test.ok();
return 0;
}
Compilation under GCC 4.4 :
hello_world.cpp: In function `int main()`:
hello_world.cpp:28: erreur: no matching function for call to `Test::ok()`
hello_world.cpp:19: note: candidats sont: virtual void Test::ok(float)
I don't understand why float ok() defined in Base isn't accessible to Test user even if it does publicly inherit from it. I've tried using a pointer to the base class and it does compile. Uncommenting the Test implementation of float ok() works too.
Is it a bug compiler? I'm suspecting a problem related to name masking but I'm not sure at all.