Inheritance Flashcards
The process of creating derived classes from a base class to enhance code reusability.
Inheritance
Inheritance relationship can be described as
superclass-subclass
is-a/an, is-a-kind-of
has-a
the “is-a” rule states that __________ of the subclass is an object of the superclass
every object
You can use a subclass object whenever the program expects a superclass.
Substitution Principle
What features can be inherited by the subclass?
Public and Protected
The super constructor must always be the ____________ in another constructor.
first statement
The collection of classes extending from a common superclass is called an ________________________
Inheritance Hierarchy
The path from a particular class to its ancestor is its ______________________.
Inheritance chain
When some methods in superclass is not appropriate for the subclasses, the solution is to _________________________
override methods
When designing Classes, place the _______________ in the superclass
general methods
Place the more ______________ in the subclass(es)
specialized methods
Subclasses are more superior because they have more functionality than superclasses
TRUE
Benefits of Inheritance
- Forms ranking or ordering of abstractions
- Simplifies our understanding of a problem
- Allows code reuse
Java employs _______ inheritance
Single
top of hierarchy
java.lang.Object