9.1 Understanding Inheritance

Cards (79)

  • The relationship between parent and child classes is based on inheritance
  • What are common inheritance patterns used in OOP?
    Code reuse, polymorphism
  • What is inheritance terminology related to in OOP?
    Classes, subclasses, superclasses
  • Inheritance promotes the modular design of software systems.

    True
  • In inheritance, the child class inherits properties and methods from the parent class.
  • The 'is-a' relationship means a subclass is a more specialized version of its superclass.
    True
  • Subclasses can add specialized properties and behaviors not found in the superclass.

    True
  • Match the aspect with the correct class type:
    General class ↔️ Superclass
    Specialized class ↔️ Subclass
  • In multiple inheritance, a subclass inherits from multiple superclasses
  • Inheritance allows classes to be organized into a hierarchical structure
  • A child class inherits properties and methods from its parent class.
  • The "is-a" relationship means that a subclass is a specialized version of its superclass
  • Match the aspect with the correct class type:
    Defines common properties ↔️ Superclass
    Inherits from superclass ↔️ Subclass
  • Multiple inheritance requires careful management to avoid conflicts.
    True
  • Method overriding is a type of polymorphism where a subclass provides its own implementation of a method.

    True
  • Method overriding allows subclasses to behave differently while maintaining the same method name.

    True
  • Match the inheritance term with its definition:
    Superclass ↔️ Base class providing common attributes
    Subclass ↔️ Class that inherits from the superclass
    Inherits ↔️ Acquires properties from superclass
    'Is-a' relationship ↔️ Subclass is a type of superclass
  • What is inheritance in object-oriented programming?
    Subclass inherits from superclass
  • The parent class in inheritance is also known as the superclass
  • Match the terms with their definitions:
    Superclass ↔️ Parent class with common properties
    Subclass ↔️ Child class that inherits from superclass
  • What does the 'is-a' relationship ensure in inheritance?
    Logical class hierarchies
  • Polymorphism allows subclasses to extend or override parent class behavior.

    True
  • What are the key advantages of inheritance in object-oriented programming?
    Code reuse and organization
  • In inheritance, subclasses can extend or override the behavior of methods inherited from the superclass.
  • Subclasses inherit common properties and methods from their superclasses while adding their specific attributes.

    True
  • Match the class types with their characteristics:
    Parent Class (Superclass) ↔️ General properties and methods
    Child Class (Subclass) ↔️ Inherits from parent class and specializes
  • Method overriding occurs when a subclass provides its own implementation of a method defined in the superclass.

    True
  • What are the roles of inheritance in parent-child relationships?
    Specialization, code reuse
  • The subclass inherits from the superclass to extend its functionality.
  • A subclass inherits properties and behaviors from its superclass
  • What is single inheritance?
    Inheriting from one superclass
  • What is the primary benefit of inheritance in OOP?
    Code reuse
  • What is another term for a parent class?
    Superclass
  • What does the "is-a" relationship describe in OOP?
    Inheritance relationship
  • What is the primary purpose of a subclass?
    Extend superclass functionality
  • Multiple inheritance allows a subclass to combine features from multiple superclasses
  • Polymorphism allows objects of different classes to be treated as objects of a common superclass
  • What are the two main types of polymorphism?
    Method Overriding and Overloading
  • Polymorphism promotes code flexibility and enhances maintainability
  • What does the term 'hierarchical organization' refer to in inheritance?
    Parent-child hierarchy