Symmetric Relation?

Exercise We could make Student a subclass 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 subclass of 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 but I've made the simplifying assumption that they don't; at least not in the sense a graduate student has a thesis advisor.