If fields make sense for one subclass but not the other, you can remove them from the superclass and push them down into the subclass they belong to.
如果一些字段对于某个子类有意义,但是对于其他子类没有意义,就可以把它们从超类中删除,并放到它们所属的子类中。
Since an instance of a subclass is an instance of your superclass, you could find multiple instances of the singleton.
由于子类的实例也是单例类的实例,所以可能出现多个单例实例并存的情况。
Every class you define is a subclass of owl: thing and a superclass of owl: Nothing.
您所定义的每个类都是owl:thing的子类,并且是owl:Nothing的超类。
Qualified subclass name: name subclasses to communicate the similarities and differences with a superclass.
子类名称要合格:对子类的命名会表述出其与超类之间的相似和差异之处。
In a subclass you can make assumptions about the internal state of the superclass when the method you override is getting called.
当子类所重写的方法被调用时,你可以在子类中对父类的内部状态进行操作。
Classes are arranged in a hierarchy, so that a subclass can inherit behavior from its superclass.
类是有层次性的,所以子类可以继承父类的行为。
The Pull up refactoring is nearly identical to Push down, except, of course, that it moves class members from a class to its superclass instead of subclass.
PullUp重构与PushDown几乎相同,当然Pull Up是将类成员从一个类中移到其父类中,而不是子类中。
Also, each subclass inherits methods from the superclass.
同时,每个亚纲继承来自总纲的方法。
Access protected fields of a subclass in a superclass?
访问受保护的子类在父类的域?
That is, how a subclass can inherit fields and methods from a superclass.
这就是,一个子类从超类中继承属性和方法。
STI in Rails: How do I change from a superclass to a subclass without accessing the "type" attribute directly?
STI导轨:我怎么改变从父类的一个子类没有访问“类型”属性直接?
According to this principle, the ability to substitute a subclass object for a superclass object is characteristic of good design.
此原则表明,子类对象对超类对象的替代能力是优秀设计的重要标志。
It is not effective to add a new static synchronized method in a subclass that attempts to protect static fields declared in a superclass.
通过在子类中增加一个静态同步方法来试图保护父类中的静态成员变量是无效的。
A class that passes properties and methods to another class is called a superclass. A class can be both a subclass and a superclass.
一个超越其他类别的类别被称为超级类别,一个类别可以既是最高类别又是超级类别。
A class that passes properties and methods to another class is called a superclass. A class can be both a subclass and a superclass.
一个超越其他类别的类别被称为超级类别,一个类别可以既是最高类别又是超级类别。
应用推荐