CarLoan
is a Loan
as are HomeImprovementLoan
s and MortgageLoan
sCarLoan
can be said to inherit from class Loan
. Loan
is a base class, and class CarLoan
is a subclassCarLoan
is a specific type of Loan
, but it’s incorrect to claim that every Loan
is a CarLoan
Base class | Subclasses |
---|---|
Student |
GraduateStudent , UndergraduateStuden |
Shape |
Circle , Triangle , Rectangle , Sphere , Cube |
Loan |
CarLoan , HomeImprovementLoan , MortgageLoan |
Employee |
Faculty , Staff |
BankAccount |
CheckingAccount , SavingsAccount |
CommunityMember
Inheritance Hierarchy¶Employee
is a CommunityMember
” Teacher
is a Faculty
member” CommunityMember
is the direct base class of Employee
, Student
and Alum
and is an indirect base class of all the other classes in the diagram
Starting from the bottom, you can follow the arrows and apply the is-a relationship up to the topmost superclassShape
Inheritance Hierarchy¶