Because every subclass object is an object of its superclass, and one superclass can have many subclasses, the set of objects represented by a superclass is typically larger than the set of objects represented by any of its subclasses. For example, the superclass Vehicle represents all vehicles, including cars, trucks, boats, bicycles and so on. By constrant, subclass Car represents a smaller, more specific subset of vehicles. List the several simple examples of superclass and subclasses.
- Student -> GraduateStudent, UndergraudateStudent
- Shape -> Circle, Triangle, Rectangle
- Loan -> CarLoan, HomeImprovementLoan, MorgageLoan
- Employee -> Faculty, Staff
- Bankaccount -> CheckingAccount, SavingAccount
Hiç yorum yok:
Yorum Gönder