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

42 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+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