Object-Oriented Programming (OOP)
Inheritance is best defined as which of the following?
- A. A contract that defines a set of methods a class must implement without specifying how.
- B. An OOP mechanism that allows a class to acquire properties and behaviors from another class. ✓
- C. A special method automatically called when an object of a class is created, used to initialize it.
- D. The ability to define multiple methods with the same name but different parameters in a class.
Correct answer
B. An OOP mechanism that allows a class to acquire properties and behaviors from another class.
Explanation
Inheritance refers to an OOP mechanism that allows a class to acquire properties and behaviors from another class.