Inheritance: Relying on derived-class functions

Let's say I've got

class A
{
virtual void sub();
void doSomething()
{
sub();
}
};

class B: public A
{
void sub()
{
printf("Hello.");
}
};

Is there a way to make this arrangement work? Currently, it's causing linker errors; and if I mark sub() as non-virtual in A, it tries to execute that when I call B::doSomething() rather than B's sub().
[462 byte] By [Lindley] at [2007-11-20 11:38:43]
# 1 Re: Inheritance: Relying on derived-class functions
Did you and do you want to implement A::sub()? If not, perhaps A should be an abstract base class instead, so A::sub() should be a pure virtual:
virtual void sub() = 0;
laserlight at 2007-11-9 1:26:03 >
# 2 Re: Inheritance: Relying on derived-class functions
Thanks, that was exactly what I was looking for.
Lindley at 2007-11-9 1:27:03 >