D
Dennis
Hi,
This may be a simple answer for somebody, but I'm unable to figure
it out. In a nutshell:
I have a base class defined. Let's call it XClient. Inside XClient I
have a virtual method called messageHandler, so it looks something
like this:
class XClient {
......
public:
virtual bool messageHandler(.....) = 0;
};
I then have a derived class looking something like:
class XClientWrapperublic XClient{
public:
bool messageHandler(....) = 0;
};
I am using this XClientWrapper class in two places in my code. In one
section I have another class that inheirits XClientWrapper's
attributes. Seems to compile and link fine.
In another section of code I specify an instance of XClientWrapper,
just a simple:
XClientWrapper *ptr = new XClientWrapper;
WHen I compile I get an error stating:
Cannot allocate an object of type XClientWrapper since the
following virtual functions are abstract. (messageHandler).
If I remove the ' = 0;' from the redefinition of messageHandler in
XClientWrapper it will compile and link. However, once I do this and
try to compile my other code that worked fine with the '=0', I get the
following link error:
Undefined reference to XClientWrapper virtual table.
It works one way with the '= 0' and not the other, and vice versa.
Any ideas?
Thanks in advance!
Dennis
This may be a simple answer for somebody, but I'm unable to figure
it out. In a nutshell:
I have a base class defined. Let's call it XClient. Inside XClient I
have a virtual method called messageHandler, so it looks something
like this:
class XClient {
......
public:
virtual bool messageHandler(.....) = 0;
};
I then have a derived class looking something like:
class XClientWrapperublic XClient{
public:
bool messageHandler(....) = 0;
};
I am using this XClientWrapper class in two places in my code. In one
section I have another class that inheirits XClientWrapper's
attributes. Seems to compile and link fine.
In another section of code I specify an instance of XClientWrapper,
just a simple:
XClientWrapper *ptr = new XClientWrapper;
WHen I compile I get an error stating:
Cannot allocate an object of type XClientWrapper since the
following virtual functions are abstract. (messageHandler).
If I remove the ' = 0;' from the redefinition of messageHandler in
XClientWrapper it will compile and link. However, once I do this and
try to compile my other code that worked fine with the '=0', I get the
following link error:
Undefined reference to XClientWrapper virtual table.
It works one way with the '= 0' and not the other, and vice versa.
Any ideas?
Thanks in advance!
Dennis