ABCs (abstract base classes) and linkage problems
I m getting a ton of linkage errors (unresolved externals) when using an
abstract base class. My classes look something like this:
class BaseObject
{
//pure virtuals
virtual void foo() = 0;
virtual int foobar(int, int, double) = 0 ;
virtual void grok();
virtual int doit();
}
class MyClass : public BaseObject
{
//pure virtuals are implemented
void foo() {...}
int foobar(int a, int b, double c){return 42;}
//these are not implemented .. and not called in code
//virtual void grok();
//virtual int doit();
}
Linkage errors (unresolved externals):
BaseObject::BaseObject(void)
void grok()
int doit();
which leads to my questions:
i). Why is the linker looking for the constructor of the ABC BaseObject?
ii). Do I need to implement the constructor of BaseObject ? (this goes
against my understanding of most languages definition of an interface)
iii).Why is the linker looking to resolve the two (non pure) virtuals in
the interface - I dont use it any where in the code - and it is only
there for "future comapatability"
What am I doing wrong ?