Symmetric Relation?
- Describe why inheritance is not a symmetric relationship.
Exercise We could make Student
a sub-class of GradStudent
. Is there any reason to prefer this to the alternative or the other way around?
Solution
Inheritance is not symmetric. The GradStudent
has properties not shared with Student
(i.e. the advisor).
If we make Student
a sub-class of the GradStudent
, it will inherit the advisor
field along with its setter and getter methods which are not meant to be part of a Student
object.
PS. I know undergraduate students may have advisors. Still, I've made the simplifying assumption that they don't, at least not in a sense a graduate student has a thesis advisor.