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.
16 cards · basic cards · AI-written, checked twice. Edit anything.
- What is inheritance?
- A mechanism where a class derives properties and behaviors from another class
- What is a superclass (parent class)?
- The class being inherited from
- What is a subclass (child class)?
- A class that inherits from another class
- What is method inheritance?
- A subclass automatically gaining access to methods defined in its superclass
- What is method overriding?
- A subclass providing its own implementation of a method already defined in its superclass
- What is single inheritance?
- A class inheriting from exactly one superclass
- What is multiple inheritance?
- A class inheriting from more than one superclass
- What is a common issue with multiple inheritance?
- Ambiguity when two superclasses define a member with the same name (the diamond problem)
- What is the 'is-a' relationship in inheritance?
- 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?
- Calling a method or constructor from the superclass
- What is a hierarchy of classes?
- A tree-like structure showing how classes relate through inheritance
- What is code reuse, as it relates to inheritance?
- Sharing common functionality defined once in a superclass across many subclasses
- What is inheritance's main risk if overused?
- Tightly coupling classes into rigid hierarchies that are hard to change
- What is composition, as an alternative to inheritance?
- Building complex behavior by combining objects rather than inheriting from a class
- What does 'favor composition over inheritance' mean?
- A design guideline suggesting object composition is often more flexible than deep inheritance