Приклади вживання A superclass Англійська мовою та їх переклад на Українською
{-}
-
Colloquial
-
Ecclesiastic
-
Computer
A superclass can have multiple subclasses.
Create a constructor in a superclass.
Create a superclass constructor and move the code that is the same in the subclasses to it.
Is behavior implemented in a superclass used by only one(or a few) subclasses?
You can notapply this technique to classes that already have a superclass.
Move the signatures of non-similar methods to a superclass as abstract ones by using Pull Up Method.
In the language of Java,a class that is inherited is called a superclass.
Push Down MethodProblem: Is behavior implemented in a superclass used by only one(or a few) subclasses?
Eases subsequent relocation of duplicate methods, if they exist, from subclasses to a superclass.
Call super: Requiring subclasses to call a superclass's overridden method.
Someone was motivated to create inheritance betweenclasses only by the desire to reuse the code in a superclass.
Move the algorithm structure and identical steps to a superclass, and leave implementation of the different steps in the subclasses.
The resulting methods that areidentical for all subclasses can be moved to a superclass via Pull Up Method.
Provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.
In most programming languages, a subclass constructor can have its own list of parameters different from the parameters of thesuperclass. Therefore you should create a superclass constructor only with the parameters that it truly needs.
Create a field and put a superclass object in it, delegate methods to the superclass object, and get rid of inheritance.
See whether the method is defined in a superclass or subclass.
If it is difficult or impossible to create a superclass, use Extract Class in one class and use the new component in the other.
See whether the method is defined in a superclass or subclass.
In this case,it is only a matter of time before someone calls a superclass method that he or she was not supposed to call.
Suppose a program contains three classes in an inheritance hierarchy: a superclass, Cat, and two subclasses, HouseCat and Lion.
This refactoring technique can also be used if, for some reason,a subclass redefines a superclass method but performs what is essentially the same work.
If the method is implemented in different ways in subclasses or in a superclass, and your parameter is used in those implementations.
Factory Method is a creational designpattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.
Create a protected superclass constructor for initializing the new fields.
Create a shared superclass for them and move all the identical fields and methods to it.
Solution: Create a shared superclass for them and move all the identical fields and methods to it.