Professional Documents
Culture Documents
Abstraction Handout
Abstraction Handout
Let's write source code by looking into the above class diagram.
Step 1: Let's first create the superclass Employee. Note the usage of abstract keyword
in this class definition. This marks the class to be abstract, which means it cannot be
instantiated directly. We define a method called calculateSalary() as an abstract method.
This way you leave the implementation of this method to the inheritors of
the Employee class.
public abstract class Employee {