Inherited

This tag refers to the classes or objects that a particular class inherits from.

Subclassing

A subclass, "derived class", heir class, or child class is a modular, derivative class that inherits one or more language entities from one or more other classes.



Class ireadwrite implements

Example

"Since ireadwrite implements ireadonly ireadwrite is said to be a subclassing of ireadonly although subclassing is more accurately used to describe a class which inherited a base class rather then implements an interface--for the sake of simplicity they are very nearly the same concept"

from question  

Optional Readonly Property in VB.Net Interface

"With subclassing is trickier because any private members of a class are not inherited by the subclassing but protected and public are"

from question  

What does this mean about returning a java immutable result?

Better custom resource

Example

"If you want to work your way from the top down especially if the subclassing selection depends on the choices made when constructing the superclass then the superclass s probably much better to favor composition over inherited"

from question  

Java - Randomly moving down a class hierarchy

"Depending on how your application is structured this means you may want to have your own base class implementing iresource which creates your custom not found resource for all of its subclassing or better make a wrapper since composition is better than inherited"

from question  

TwistedWeb: Custom 404 Not Found pages

Superclass class lines

Example

"Perhaps a 1000 lines class should be decomposed in other classes or subclassing if in your case inherited is more valuable than composition so every class has a well defined responsibility in the system"

from question  

What can be said about this java class?

"This is also a situation where aggregation one class has other classes makes more sense than inherited a subclassing is a superclass"

from question  

Java UML Student Worker project multiple inheritance

"Similarly as the subclassing gains more methods it inherited the list of superclass in the order in which they were named that precede it"

from question  

Why are Super-class and Sub-class reversed?

New functionality hashmap

Example

"Also i recommend you use hashmap instead of subclassing hashmap prefer composition over inherited"

from question  

Java Generics: How to create a to-n collection with configurable value holder type

"We prefer composition over inherited because when we add particularly or change functionality by subclassing we couple that new functionality to the class - so anywhere we need the new functionality we need that class"

from question  

Disadvantages of inheritance in java

"Inherited is more useful when a new subclassing wants to change the way a method works if you just need to change the data the class uses to work probably an approach like this would do the trick"

from question  

Alternatives to static methods in Java

Hierarchy generalization specialization

Example

"Your subclassing becomes more specialized and less generalized as you move down the inherited hierarchy"

from question  

Generalization and Specialization - What is the differences

"Inherited thus implies a generalization;specialization hierarchy wherein a subclassing specializes the more general structure"

from question  

Why can't reference to child Class object refer to the parent Class object?

Others

Example

When you proceed this way there is not a problem with the fragile class or at least the designer is conscious or the threat and the subclassing do complete only those parts the designer allow them;inherited is more to specialize the classes in the same fashion a truck is an specialized version of car and mostertruck an specialized version of truck

from question  

Is OOP & completely avoiding implementation inheritance possible?

With inherited this is less likely to happen due the contractual nature of subclassing abstract classes

from question  

Duck typing Vs class based Inheritance

Composability having frozendict have a _dict properties is much easier to reason about than inherited subclassing dict in many cases

from question  

Mutable Wrapper for Immutable Dictionary

The abstract_class properties is more or less a way to subclassing models without invoking sti single table inherited

from question  

Rails using multiple databases - no implicit conversion of nil into String

If a subclassing needs more information than the standard parameters which came up for us you have the option of a second parameters class type that you use as a second parameter but then you have two types of constructors in the tree or using inherited in the parameters class hierarchy

from question  

How can I avoid creating useless pass-through constructors in child classes just to pass arguments to "super()"?

While the methods is a debated recommendation to favor composition over inherited my view is to ensure that an abstract-class devoid of abstract methods is not simply a convenient container for methods convenient to subclassing but instead that each subclassing could stand in for each subclassing superclass

from question  

What is the purpose of abstract class which doesn't have any abstract methods in it?

See if you want to use inherited;have a base class with fields that you want to share with everyone and a subclassing which has more restricted data

from question  

How to work with multiple 'views' of the same domain model?

But native hibernate support regarding inherited mapping is more powerful than standard jpa and single table per class hierarchy or table per subclassing mapping strategies are more suitable for polymorphic queries and associations than table per concrete class strategy

from question  

Mapping a polymorphic list with JPA?

My general rule of thumb before using inherited consider if composition makes more sense;reason subclassing usually means more complexity and connectedness harder to change maintain and scale without making mistakes

from question  

Should I subclass JFrame/JPanel or not?

In your case using inherited is tight coupling and also breaks in encapsulation if you have more than one subclassing also same for abstract class

from question  

What is the reccommended pattern for re-using a data contract as an object model in code?

C++ inherited is also slightly more complicated than java inherited because multiple inherited is supported and as such virtual inherited is also an option

from question  

Is "derived" in C++ the same thing as "extended" in Java?

For example all new-style classes inherited from object so any case of multiple inherited provides more than one path to reach object;to keep the base classes from being accessed more than once the dynamic algorithm linearizes the search order in a way that preserves the left-to-right ordering specified in each class that calls each parent only once and that is monotonic meaning that a class can be subclassing without affecting the precedence order of a class parents

from question  

Python multiple inheritance super function

I generally use interfaces are too enforce a common behavior that a group of classes share whereas subclassing is more appropriately used in cases where you can achieve serious code re-use through inherited functions properties

from question  

AS3 - when to implement or extend?

From a good database design point of view joined table inherited is better;joined table inherited enables you to have foreign keys to subclassing enforced by the database it s a lot simpler to have non-null constraints for subclassing fields

from question  

SQLAlchemy Inheritance

Ut a list of childthing1 s cannot handle a childthing2 or indeed any implementor of iparentthing other than childthing1 - in other words if the was allowed to cast as a the would have to be able to deal with all subclassing of iparentthing not just iparentthing and childthing1;note that java generics have a way to say that i want a list of anything that inherited from this in addition to i want a list of anything that this inherited which allows for more interesting and in my opinion elegant solutions to some problems

from question  

Is it wrong to cast an enumerator of a child class to an enumerator of a parent class?

Note that inherited is harder to maintain than composition;also i would rename tests to testcollection if you subclassing list or something like testunit if it would contain list of test classes

from question  

Should I subclass List<T> or have it as a property?

It is elegant and honors basic inherited contracts between superclass and subclassing;even in your original post the subclassing is actually more restrictive than the superclass so doing something like

from question  

Override Setter in Subclass

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0