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:
using SomeMiddlewareClass::DoAThing;
void DoAThing( const char* const* withThat ) {}
SomeEndClass() {}
virtual ~SomeEndClass() {}
};
int main()
{
SomeEndClass* myClass = new SomeEndClass();
myClass->DoAThing( "withThis" );
((SomeMiddlewareClass*)myClass)->DoAThing( "withThisToo" );
delete myClass;
}
Y2xhc3MgQWJzdHJhY3RCYXNlQ2xhc3MKewogICAgcHVibGljOgoKICAgICAgICB2aXJ0dWFsIHZvaWQgRG9BVGhpbmcoIGNvbnN0IGNoYXIqIHdpdGhUaGlzICkge30KICAgICAgICB2aXJ0dWFsIHZvaWQgRG9BVGhpbmcoIGNvbnN0IGNoYXIqIGNvbnN0KiB3aXRoVGhhdCApID0gMDsKCiAgICAgICAgQWJzdHJhY3RCYXNlQ2xhc3MoKSB7fQogICAgICAgIHZpcnR1YWwgfkFic3RyYWN0QmFzZUNsYXNzKCkge30KfTsKCmNsYXNzIFNvbWVNaWRkbGV3YXJlQ2xhc3MgOiBwdWJsaWMgQWJzdHJhY3RCYXNlQ2xhc3MKewogICAgcHVibGljOgoKICAgICAgICB2b2lkIFRoaXNJc0Nvb2woKSB7fQoKICAgICAgICBTb21lTWlkZGxld2FyZUNsYXNzKCkge30KICAgICAgICB2aXJ0dWFsIH5Tb21lTWlkZGxld2FyZUNsYXNzKCkge30KfTsKCmNsYXNzIFNvbWVFbmRDbGFzcyA6IHB1YmxpYyBTb21lTWlkZGxld2FyZUNsYXNzCnsKICAgIHB1YmxpYzoKCiAgICAgICAgdXNpbmcgU29tZU1pZGRsZXdhcmVDbGFzczo6RG9BVGhpbmc7CiAgICAgICAgdm9pZ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