I have a C++ class Logger that implements Logger_IF which has one pure virtual function defined:
virtual void log( string message ) = 0;
I would like to extend Logger to my own class with it's own interface. I have called my class SpecialLogger which extends SpecialLogger_IF. SpecialLogger_IF itself extends Logger. I have defined:
virtual void log( string message, string extra ) = 0;
on my SpecialLogger_IF class. As I understand this, I should be able to still call log("message") through SpecialLogger_IF as well as log("message", "extra") however I cannot get this to work.
#include <iostream>
using namespace std;
class Logger_IF
{
    public:
        virtual void log( string message ) = 0;
        virtual ~Logger_IF() {};
};
class Logger : public Logger_IF
{
    public:
        void log( string message )
        {
            this->out( message );
        }
    protected:
        void out( string message )
        {
            cout << "LOG: " << message << endl;
        }
};
class SpecialLogger_IF : public Logger
{
    public:
        virtual void log( string message, string extra ) = 0;
        virtual ~SpecialLogger_IF() {};
};
class SpecialLogger : public SpecialLogger_IF
{
    public:     
        void log( string message, string extra )
        {
            this->out( message );
            this->extra( extra );
        }
    private:
        void extra( string extra )
        {
            cout << "^ EXTRA: " << extra << endl;
        }
};
int main( int argc, char *argv[] )
{
    Logger_IF* logger = new Logger();
    logger->log( "message" );
    delete logger;
    SpecialLogger_IF* spLogger = new SpecialLogger();
    spLogger->log( "message" );
    spLogger->log( "message", "extra" );
    delete spLogger;
}
and I get the following error:
testing.cpp:62:27: error: too few arguments to function call, expected 2, have 1
        spLogger->log( "message" );
        ~~~~~~~~~~~~~            ^
testing.cpp:34:3: note: 'log' declared here
                virtual void log( string message, string extra ) = 0;
                ^
1 error generated.
Interestingly calling this->out( message ) inside void log( string message, string extra ) does work so some inheritance is taking place. 
Is what I'm doing correct and possible, or am I missing something.
Regards
Al
 
    