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?

  1. A.

    Polymorphism

  2. B.

    Abstraction

  3. C.

    Encapsulation

  4. D.

    Inheritance

Attempted by 181 students.

Show answer & explanation

Correct answer: D

Inheritance is an important concept of Object-Oriented Programming (OOP) that allows one class to acquire the properties (data members) and behaviors (methods) of another class.

The class that inherits is called the derived class or child class, and the class whose properties are inherited 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.

Explore the full course: Bpsc