answersLogoWhite

0


Best Answer

One of the earliest motivations for using inheritance was the re-use of code which already existed in another class. This practice is usually called implementation inheritance.

In most quarters, class inheritance for the sole purpose of code re-use has fallen out of favor.The primary concern is that implementation inheritance does not provide any assurance of polymorphic substitutability-an instance of the re-using class cannot necessarily be substituted for an instance of the inherited class. An alternative technique, delegation, requires more programming effort but avoids the substitutability issue. In C++ private inheritance can be used as form of implementation inheritance without substitutability. Whereas public inheritance represents an "is-a" relationship and delegation represents a "has-a" relationship, private (and protected) inheritance can be thought of as an "is implemented in terms of" relationship.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How does inheritance promote code reuse?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why you need to use inheritance?

Inheritance is an object oriented programming concept that helps us with the following benefits:You can reuse existing code instead of having to write them againredundancy of code is avoidedrework and maintenance is easy


What could be the main advantage of inheritance concept of object orientation?

Code Reuse and avoiding redundancy is the main advantage of inheritance concept. Using inheritance, instead of rewriting a piece of code again in a class, we inherit the features from the parent class and use it instead


Which concept in java implements the concept of reusabilityand what are it's types?

One important aspect of code reuse is related to inheritance, which is a standard part of OOP programming.


Can you reuse your mopod code on moshi mosnters?

No, You can't reuse your code.


The ways in which inheritance promotes software reuse?

Inheritance allows classes to be reused by creating a direct relationship superclasses and subclasses. By allowing a subclass to inherit from a superclass, less code is required to develop new subclasses. Hence how the term reuse comes into play. A subclass is essentially "reusing" what has already been developed in the superclass.


What is object composition and delegation?

Object composition is a design technique where an object contains other objects as attributes to achieve reuse and modularity. Delegation is a programming pattern where an object passes responsibilities to another object to achieve code reuse and maintainability. Both techniques promote code reuse, modularity, and maintainability in object-oriented programming.


What is public inheritance in java?

Inheritance is a Java feature by which we can reuse code and programming logic from one class in another class. We implement Inheritance using the extends keyword.Ex: public class Ferrari extends Car {…}Here the Ferrari Class will extend features from the Car Class.This is Inheritance. The different types of Inheritance are:Single InheritanceMulti-Level InheritanceMultiple Inheritance (Java supports only Partial Multiple Inheritance) andHybrid Inheritance


What is hierarchal inheritance?

Hierarchical inheritance is a type of inheritance in object-oriented programming where classes are organized in a hierarchical structure. It means that a derived class can inherit attributes and methods from a base or parent class, and it can further be inherited by other classes. This allows for code reuse and promotes modularity in the program.


How do you reuse an iTunes code?

you dont. there for single use


What is a use inheritance?

Code Re-use is one of the biggest uses of Inheritance


Can you reuse code on moshi monsters?

It depends where the code came from. There are many moped codes that are availabe which you can reuse. However, codes which came from cards/stickers can not be used twice.


Which is the mechanism of reusing the existing class without modification?

we can use classes in java...by inheritance concept...we can reuse without modification