Transitive Relation?
- Describe multi-level inheritance.
Exercise Would it be possible to create a chain of inheritance relationships as in the following example?
(a) Yes
(b) No
Solution
Yes! Inheritance is transitive. If GradStudent is a sub-class of Student and PhdStudent is a sub-class of GradStudent, then PhdStudent is also a sub-class of Student.
The chain of inheritance relationships is known as "multi-level inheritance" (where a sub-class is inherited from another sub-class).
Multi-level inheritance is supported in Java.