Question
Objectives Exploring Inheritance and Overriding Methods Be able to design inheritance class relationships Be able to use an abstract class Be able to override a
Objectives
- Exploring Inheritance and Overriding Methods
- Be able to design inheritance class relationships
- Be able to use an abstract class
- Be able to override a virtual methods and implement an abstract method
Pre-Lab Questions
- Give an example of a good use of an abstract class not mentioned in the class.
- How many children can any parent class have? How many parents can a child class have?
- How can you make sure a method is not overridden in a child class?
Activities:
In this lab activity, we design an inheritance hierarchy containing types of employees in a companys payroll application. In this company, commission employees (who will be represented as objects of a superclass) are paid a percentage of their sales, while base-salaried commission employees (who will be represented as objects of a subclass) receive a base salary plus a percentage of their sales.
You need to implement the following design.
In the Testapplication you need to create a commissionEmployee object and a BasePlusCommissionEployee object using a data of your choice. Then call the toString method and print the earning on each object.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started