Which concept of C++ is used to reuse the written code?
2023
Which concept of C++ is used to reuse the written code?
- A.
Polymorphism
- B.
Inheritance
- C.
Encapsulation
- D.
More than one of the above
- E.
None of the above
Attempted by 303 students.
Show answer & explanation
Correct answer: B
In C++, the concept used to reuse written code is inheritance. Inheritance allows a class to inherit properties and methods from another class, enabling the reuse of existing code without rewriting it. This promotes code efficiency and reduces redundancy.