C++ interface inheritance problem

Posted by james t on Stack Overflow See other posts from Stack Overflow or by james t
Published on 2010-12-24T14:12:21Z Indexed on 2010/12/24 15:54 UTC
Read the original article Hit count: 244

Filed under:

Hey, i'm trying to create a c++ stomp client, my client constructor is :

Client(std::string &server, short port, std::string &login, std::string &pass, Listener &listener);

it gets a listener object which when Listener is the following interface :

class Listener {

    virtual void message(StmpMessage message) =0;
};

now i attempt to instantiate a client in a test class :

class test : public virtual Listener {
public:
    void message(StmpMessage message) {
        message.prettyPrint();
    }
     int main(int argc, char* argv[])
    {

        Client client("127.0.0.1", 61613, *this);
        return 0;
    }


};

i'm sending this to the client because this is a listener object, i get the following error :

/Users/mzruya/Documents/STOMPCPP/main.cpp:18: error: no matching function for call to 'Client::Client(const char [10], int, test&)'
/Users/mzruya/Documents/STOMPCPP/Client.h:43: note: candidates are: Client::Client(std::string&, short int, std::string&, std::string&, Listener&)
/Users/mzruya/Documents/STOMPCPP/Client.h:37: note:                 Client::Client(const Client&)

© Stack Overflow or respective owner

Related posts about c++