CPSC 233 Lecture 8: 22Feb

35 views2 pages

Document Summary

Object-oriented languages: support classes and inheritance. Concrete or leaf classes: classes that will have instances: most classes are concrete. Abstract classes: classes with no instances: expected that subclasses will add structure and behavior to the inherited from the abstract class, the subclasses will have instances (i. e are concrete) Polymorphism: where the same message can be sent to two objects of diferent classes: works because the classes are related in the inheritance hierarchy i. e there is a common superclass where the instance method originally is deined. The subclass redeine the instance method, so that behavior is specialized in some way. Dog fido; sam. eat(food); fido. eat(food); sam and ido are polymorphic: sam is both a chimpanzee and a mammal, ido is both a dog and a mammal, the eat() instance method is originally deined in the mammal class. Denote whole/part relaionships: i. e has a relaionship, eg: a car has an engine, chassis, wheels, etc.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents