A friend and I had a very interesting discussion about the construction of Objects that ended up with this piece of code:
#include
class Pa
The compiler knows that when you call doSomething
from inside the constructor, that call must reference doSomething
in this class, even if it is virtual. So it will optimize away the virtual dispatch and instead just do a normal function call. Since the function is not defined anywhere, this results in an error at link-time.