Variable
d
is an instantiation of a
cderived
class. So any call to
foobar
requires an integer to be passed to it, as per the signature of the function in that class. In order to call the base version you need to cast
d
to a
cbase
object thus:
cderived d;
static_cast<cbase>(d).foobar();