Discuss the ways in which inheritance promotes software reuse, saves time during program development and helps prevent errors.
The Answer to the Question
is below this banner.
Can't find a solution anywhere?
NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?
Get the Answers Now!You will get a detailed answer to your question or assignment in the shortest time possible.
Here's the Solution to this Question
Answer
Inheritanceallowsdeveloperstocreatederivedclassesthatreusecodedeclaredalready in a base class.
Avoiding the duplication of common functionality between several classes by building an inheritance hierarchy to contain the classes can save developers a considerable amount of time.
Similarly, placing common functionality in a single base class, rather than duplicating the code in multiple unrelated classes, helps pre- vent the same errors from appearing in multiple source-code files.
If several classes each contain duplicate code containing an error, the software developer has to spend time correcting each source-code file with the error.
However, if these classes take ad- vantage of inheritance, and the error occurs in the common functionality of the base class, the software developer needs to modify only the base class’s code.