It says there is no definition because there is no definition. You've declared A::foo()
, but not defined it.
Perhaps you want it to be pure virtual (making the base class A
abstract):
virtual void foo() = 0;
In this case, it doesn't need a definition, since it will always be overridden in any class that can be instantiated.
Or perhaps you want to be able to instantiate A
directly, in which case it will need a definition.