CSC 216 Lecture Notes - Lecture 5: Code Reuse, Joshua Bloch, Maltose

44 views5 pages
1 Sep 2016
School
Course
Professor

Document Summary

When writing programs, we want to write common code once and use it as many times and in many contexts: find commonalities, customize with any additional information, only one place to modify if there"s a bug. Inheritance: a programming technique in which a derived class extends the functionality of a base class, inheriting all of its states and behaviors. Inheritance hierarchy: a set of hierarchical relationships between classes of objects: a hierarchal connection between two categories where one type can be treated as a specialized version of the other. Superclass: the parent class in an inheritance relationship. Subclass: the child class in an inheritance relationship; subclass extends the superclass: note: in java, a class can have only one superclass. But a superclass can have many subclasses: public class extends Obviously, this means that the superclass is constructed first: it can have new state and add new behaviors.

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