Object-Oriented Programming, unit: Inheritance. Core concepts, terminology, and worked-example cues a college student meets for this unit, building on prior units without repeating them. Front: a term, concept, or short problem cue. Back: the definition, explanation, or answer.
38 cards · basic cards · AI-written, checked twice. Edit anything.
- What is inheritance?
Show answer
A mechanism where a class derives properties and behaviors from another class
- What is a superclass (parent class)?
Show answer
The class being inherited from
- What is a subclass (child class)?
Show answer
A class that inherits from another class
- What is method inheritance?
Show answer
A subclass automatically gaining access to methods defined in its superclass
- What is method overriding?
Show answer
A subclass providing its own implementation of a method already defined in its superclass
- What is single inheritance?
Show answer
A class inheriting from exactly one superclass
- What is multiple inheritance?
Show answer
A class inheriting from more than one superclass
- What is a common issue with multiple inheritance?
Show answer
Ambiguity when two superclasses define a member with the same name (the diamond problem)
- What is the 'is-a' relationship in inheritance?
Show answer
A subclass represents a specialized version of its superclass, such as a Dog is an Animal
- What is 'super' typically used for in a subclass?
Show answer
Calling a method or constructor from the superclass
- What is a hierarchy of classes?
Show answer
A tree-like structure showing how classes relate through inheritance
- What is code reuse, as it relates to inheritance?
Show answer
Sharing common functionality defined once in a superclass across many subclasses
- What is inheritance's main risk if overused?
Show answer
Tightly coupling classes into rigid hierarchies that are hard to change
- What is composition, as an alternative to inheritance?
Show answer
Building complex behavior by combining objects rather than inheriting from a class
- What does 'favor composition over inheritance' mean?
Show answer
A design guideline suggesting object composition is often more flexible than deep inheritance