670 likes | 811 Views
Chapter 11. Object-Oriented Programming: Inheritance. 11.2 Base Classes and Derived Classes. “is a” . 11.3 protected Members. Overriding Methods. Overriding Methods. Keep it. change. augmented . Overriding Methods.
E N D
Overriding Methods Keep it change augmented
Overriding Methods • virtual– tells the compiler that this method CAN be overridden by derived classes • override – in the subclass, tells the compiler that this method is OVERRIDINGthe same method in the base class • base – in the subclass, calls the base class’s method
Abstract Classes cont abstract class
11.4.2 Creating a BasePlusCommissionEmployee Class without Using Inheritance
11.4.3 Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy
11.4.4 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables protected members public virtual decimal Earnings()
11.4.5 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables