I wrote the code below in order to explain my issue. If I comment the line 11 (with the keyword "using"), the compiler does not compile the file and display this error: invalid conversion from 'char' to 'const char*'
. It seems to do not see the method void action(char)
of Parent class in Son class.
Why the compiler behaves this way? Or have I done something wrong?
class Parent
{
public:
virtual void action( const char how ){ this->action( &how ); }
virtual void action( const char * how ) = 0;
};
class Son : public Parent
{
public:
using Parent::action; // Why shall i write this line?
void action( const char * how ){ printf( "Action: %c\n", *how ); }
};
int main( int argc, char** argv )
{
Son s = Son();
s.action( 'a' );
return 0;
}