In OOP, which term refers to a mechanism by which a class can inherit…

2025

In OOP, which term refers to a mechanism by which a class can inherit properties and behaviors from another class?

Answer: D. InheritanceObject-Oriented Programming rests on four pillars that describe how classes model real-world entities and share structure among themselves. One of these…

  1. A.

    Polymorphism

  2. B.

    Abstraction

  3. C.

    Encapsulation

  4. D.

    Inheritance

Attempted by 393 students.

Show answer & explanation

Correct answer: D

Object-Oriented Programming rests on four pillars that describe how classes model real-world entities and share structure among themselves. One of these pillars is the mechanism that lets a class acquire the properties (data members) and behaviors (methods) already defined in another class, so the acquiring class does not have to redefine them from scratch.

This mechanism is called Inheritance. The class that acquires members is called the derived class or child class, and the class it acquires them from is called the base class or parent class.

Inheritance promotes:

  • Code reusability

  • Hierarchical classification

  • Easier maintenance of programs

Example:

class Animal
{
public:
    void eat() {}
};

class Dog : public Animal
{
};

Here, class Dog inherits the properties and behaviors of class Animal.

Contrast with the other OOP pillars offered as options:

  • Polymorphism — one interface takes many forms; the same method call behaves differently for different objects (e.g., via overriding/overloading). It does not describe a class acquiring another class's members.

  • Abstraction — hides internal implementation details and exposes only essential features. It is about simplifying what is shown, not about member acquisition between classes.

  • Encapsulation — bundles data and methods into a single unit and restricts direct access. It is about protecting members within one class, not passing them to another class.

  • Only Inheritance describes the class-to-class acquisition of properties and behaviors asked about in the question.

Explore the full course: Bpsc

Loading lesson…