You can also make your class abstract which will require that derivations of it are implemented and it will prevent the base class itself from being instantiated. Here is how that might look :
class BaseClass
{
public:
void fn(int i)
{
notify( i );
}
virtual void notify( int i ) = 0; };
class Derived1 : public BaseClass
{
public:
virtual void notify( int i )
{
printf( "notification 1 : value is %d\n", i );
}
};
class Derived2 : public BaseClass
{
public:
virtual void notify( int i )
{
printf( "notification 2 : value is %d\n", i );
}
};
and this little testing function will compile and run :
void TestDerivation()
{
Derived1 d1;
d1.fn( 42 );
Derived2 d2;
d2.fn( 24 );
}