What is inheritance in object-oriented programming?
A
A type of variable
B
A class acquiring properties of another class
C
A database key
D
A type of loop
Correct Answer: Option B — A class acquiring properties of another class
Explanation:
Inheritance is an OOP concept where a new class, called a subclass, derives properties and behaviors from an existing class, called a superclass, promoting code reusability.