Given the following code example, why does the overloaded AbstractBaseClass::DoAThing( const char* ) not display as an inherited method in SomeEndClass that implements the overloaded pure abstract DoAThing( const char* const* ) method?
class AbstractBaseClass { public: virtual void DoAThing( const char* withThis ) {} virtual void DoAThing( const char* const* withThat ) = 0; AbstractBaseClass() {} virtual ~AbstractBaseClass() {} }; class SomeMiddlewareClass : public AbstractBaseClass { public: void ThisIsCool() {} SomeMiddlewareClass() {} virtual ~SomeMiddlewareClass() {} }; class SomeEndClass : public SomeMiddlewareClass { public: void DoAThing( const char* const* withThat ) {} SomeEndClass() {} virtual ~SomeEndClass() {} }; void SomeFunction() { SomeEndClass* myClass = new SomeEndClass(); myClass->DoAThing( "withThis" ); ((SomeMiddlewareClass*)myClass)->DoAThing( "withThisToo" ); delete myClass; }
The compiler (and indexer) creates the following error in the line myClass->DoAThing( "withThis" ); , while the string ((SomeMiddlewareClass*)myClass)->DoAThing( "withThisToo" ); accepted.
Invalid arguments. Candidates: void Doathing (const char * const *)
there is no corresponding function to call "SomeEndClass :: Doathing (const char [9])
Should SomeEndClass inherit the implementation of AbstractBaseClass::DoAThing( const char* ) ? What am I doing wrong?
source share