Hi,
Another, is when I am linking, it complains about the
vtable and won't
compile. This error leaves me baffled because usually the class compiled
and ran before without any problems, and I didn't change it at all.
class thisFooWillNotCompile
{
public:
virtual void thisFooMakesMeAngry() = 0;
};
class thisFooIsNoGood : public thisFooWillNotCompile
{
public:
void thisFooMakesMeAngry() { printf("I will not link I will say
vtable blah blah blah and die..\n"); }
};
Sorry I am vague but, if I knew why this was happening, I would be an
advanced C++ programmer.One of them appears to be an error in my code,
but the way it manifests itself is weird.
You always need a virtual destructor in the class if you do inhertance.
Otherwise upon destruction of the derived class, the baseclass destructor
will not be called.
Cheers,
Niels.
so:
class thisFooWillNotCompile
{
public:
virtual ~thisFooWillNotCompile(); // ADD THIS!
virtual void thisFooMakesMeAngry() = 0;
};
class thisFooIsNoGood : public thisFooWillNotCompile
{
public:
virtual ~thisFooIsNoGood(); // ADD THIS!
void thisFooMakesMeAngry() { printf("I will not link I will say vtable
blah blah blah and die..\n"); }
};