Understanding Inheritance in Object-Oriented Programming
What is the concept of inheritance in object-oriented programming?
A) It allows a class to inherit attributes and methods from another class.
B) It is a way to define a new class based on an existing class.
C) It promotes code reusability and reduces redundancy.
D) All of the above.
Answer:
D) All of the above.
In object-oriented programming, inheritance is a fundamental concept that allows a class to inherit attributes and methods from another class. By defining a new class based on an existing class, developers can leverage the functionality and structure of the parent class, promoting code reusability and reducing redundancy.