9.4.3 Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy
Now we declare class BasePlusCommissionEmployee
(Fig. 9.8) to extend class CommissionEmployee
(Fig. 9.4). A BasePlusCommissionEmployee
object is a CommissionEmployee
, because inheritance passes on class CommissionEmployee
’s capabilities. Class BasePlusCommissionEmployee
also has instance variable baseSalary
(Fig. 9.8, line 6). Keyword extends
(line 4) indicates inheritance. BasePlusCommissionEmployee
inherits CommissionEmployee
’s instance variables and methods.
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.