CMPSC 32 Lecture Notes - Lecture 10: Subtyping, Liskov Substitution Principle

42 views2 pages
26 Sep 2017
School
Course
Professor

Document Summary

Object-based-programming = using objects for encapsulation, but not using subclasses. Could create objects directly or use classes and instantiate (using new operator) Non-obp can simulate this by, for example, having a default first parameter. Templates/generics are not specifically a part of object-oriented. New classes can be declared to be children of parent class. Derived class automatically gets (inherits) all members (data and methods) of base class. Can instantiate those classes, design their own small hierarchies. Possible to inherit from more than one class. Class can inherit code from only one parent. Can implement any number of pure virtual classes in c++ Use (function) overloading to do different things to different types. Use template to do the same thing to different types. Instance of derived class is also considered a valid instance of base class. Meaning of a message depends on the runtime (dynamic) type of the receiver.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents