Inheritance (Cont.)


Reuse by Inheritance, Redefinition, and Conflicts (Cont.)

Reusability of type information
Each object belonging to the class employee has values for those attributes of person without having to define the attributes within the class.

Default value (reusability of values)
employee IsA person: [
  ...,
  salary: INTEGER ( value: 1000 ) ]

Redefinition (overwritten)
manager IsA employee, shareholder: [
  ...,
  driver: employee ]

Multiple inheritance
Class manager has two immediate superclasses, namely employee and shareholder. Problems include: There are three ways to solve the issue of inheritance conflicts:
  1. Assigning priorities: employee has priority over shareholder.

    manager IsA employee, shareholder
  1. Based on the from-clause:
manager IsA employee, shareholder: [
  staff: { employee },
  account INHERITED FROM employee ]

  1. Restricting the inheritance hierarchy:
emplsha IsA employee, shareholder: [
  account: INTEGER ]
manager IsA  emplsha [
  staff: { employee } ]