// No bonus for you! Error!
public override void GiveBonus(float amount)
{
// Rats. Can't change this method any further.
}
}
we receive compile-time errors.
Understanding Abstract Classes
Currently, the Employee base class has been designed to supply protected member variables for its
descendents, as well as supply two virtual methods (GiveBonus() and DisplayStats()) that may be
overridden by a given descendent. While this is all well and good, there is a rather odd byproduct of
the current design; you can directly create instances of the Employee base class:
Do'stlaringiz bilan baham: |