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.

Superclass

A superclass is a parent or base class that is derived or inherited from by a child class (or subclass)

Arguments init method

Quality Example
More

"If the subclassing is more specific then it might fill in all by 2 of the arguments to its superclass __init__ method"

from question "Validating Python Arguments in Subclasses"

"In other words if a subclassing is more accessible than its superclass then the access modifier of the superclass loses effect"

from question "Swift:Class cannot be declared public because its Super class is internal"

"Shouldn t a subclassing interfaced be able to take in more than the superclass interfacec and use the same method"

from question "Implement interface by taking superclass of parameter"

"If we are creating an object of a subclassing and invoking the method of superclass and if subclassing extends more than one class which superclass method should be called"

from question "Why is Multiple Inheritance not allowed in Java or C#?"

"Subclassing must allow more than the superclass not less and going from an argument being optional to not optional is allowing less"

from question "How to not violate the Liskov substitution principle when methods have optional parameters?"

Weaker reference

"So i inspected the compiled firebasemessagingservice which was the subclassing of com.google.firebase.iid.zzb and had zzae intent method as private but its subclassing firebasemessagingservice had protected access i know that subclassing cannot have weaker reference than its superclass so i guess there is something wrong with firebasemessagingservice library"

from question "FirebaseMessagingService cannot override zzae(Intent) in zzb. Weaker reference error"

Less acts

"These relations naturally arise when you impose restrictions on what you can handle--then if a subclassing means that the method can handle less acts as a superclass of since can handle everything that the subclassing can handle and more"

from question "Where's the contravariance?"

Less arguments

"If you subclassing has less arguments than a superclass and you could make them optional in the superclass just add placeholders in the subclassing"

from question "Silence "Declaration ... should be compatible" warnings in PHP 7"

Weaker access

"The subclassing overridden method cannot have weaker access than superclass method"

from question "Method overiding and inheritance"

Fewer arguments

"With explicit superclass calling your subclassing can accept more or fewer arguments than its superclass and can decide itself what to pass when calling the superclass"

from question "Understanding calling parent __init__ in subclass"

Narrower

"However if the subclassing returns a narrower subtype of the superclass method return this is called a covariant return type and is allowed in java since jdk 1.5"

from question "Different return types of abstract method in java without casting"

Smaller complex bigger

Quality Example
Bigger

"In this case superclass is bigger than subclassing that s why the second statement is correct"

from question "Java extending classes"

More

"However they are not the same because the subclassing has more specific functions and data members that accomplish a more specific task that the superclass"

from question "Inheritance concept java..help"

"The general problem is that the subclassing is more specific than the superclass"

from question "Use extended class in place of base class"

"Superclass defines more general features of the objects of its subclassing"

from question "Java Inheritance: Distinguishing between the IS-A and the HAS-A relationships"

More flexible

"A subclassing is more flexible and is treated as an entire object which responds to all superclass methods plus it s own"

from question "Categories on NSObject -- keeping it safe"

Smaller

"2 since superclass is smaller than subclassing one should use memory object carefully"

from question "Can't downcast because class is not polymorphic?"

Always smaller less

"For my understanding the superclass is always smaller less complex then the subclassing"

from question "Why is it possible to define an variable with type of a superclass, but assign it an object of a subclass?"

Presumably more

"If new member fields are declared in the subclassing then yes a subclassing presumably uses more memory since it has all the fields declared in the superclass plus all the fields declared in the subclassing"

from question "Will extend create an object of its super class.?"

Bigger interface

"You can t cast a superclass in a subclassing because the subclassing may have a bigger interface than the superclass means the subclassing can have functions like getunixtimestamp that the superclass doesn t have"

from question "Java typecasting and inheritance"

Others

Quality Example
More

"Watch out you can t query a superclass if you have more than 1 subclassing then something like in jql"

from question "How map superclass in JDO with similar behaviour to @MappedSuperclass in JPA"

"In enhanced er modelling subclassing inheriting from more than 1 superclass is called multiple inherited"

from question "Multiple Inheritance ER Model"

"Take note of this there is no way to subclassing more than one superclass at a time"

from question "How to extend Fragment and Activity"

More specific

"For example you want to use abstract-class in such a case that each of the subclassing is a more specific type of its abstract superclass fruit apple orange banana grape strawberries etc. and you want to use non-abstract superclass in a relationship such as dad and son"

from question "What is a good design pattern for using an abstract superclass?"

Less methods

"You cannot have a subclassing with less methods than a superclass"

from question "Remove/Deprecate a method in subclass"

More selective

"The fact that the subclassing is more selective only actually writes about what it writes is new functionality especially in light of the fact that the superclass promises nothing"

from question "Why declare an instance as a supertype but instantiate it as a subtype, plus Liskov Substitution Principle"

More sense

"Here having a superclass makes more sense or at least having a realnumber subclassing of number"

from question "Abstract vs Regular Super Class"

More stringent

"The superclass has a more stringent constraint on a property content blank false than the subclassing content nullable true and i am using tableperhierarchy false"

from question "Issue with inheritance and constraints in Grails/GORM"

Lower visibility

"Still you cannot inherited from a as superclass cannot have a lower visibility than subclassing"

from question "Public class extends internal class"

More values

"So what this says is that provided your subclassing doesn t have any more values than the superclass used to determine ordering implementing is reasonable"

from question "Is there ever a reason to implement java.util.Comparable for a type other than itself?"

No longer

"This breaks the inherited and the subclassing is no longer an instance of the superclass"

from question "JavaScript inheritance, superclass identifier in subclass is not defined, even though it is"

Higher altitudes

"Yes but if you think of your diagram as a topographic map the subclassing have higher altitudes than the superclass"

from question "Why are Super-class and Sub-class reversed?"

Less classes

"Hence your subclassing is accepting less classes than the superclass contract promises"

from question "Generic Confusion on Inheritence -- Java"

Actually more

"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-3.0