例如:
- You have two classes (unleast)
- both classes can be instantiated (concrete, not pure or abstract)
- one class is a superclass of another
- both classes are instantiated with a "factory" method
- the "factory" method of a subclass can invoke the the "factory" method of the superclass
- each "factory" method can have several type or count of parameters
<><>Problem>
我现在要注意:
class B extends A {
public static function factory() {
return parent::factory( constant );
}
}
www.un.org/spanish/ecosoc 简讯和快速回答:
修改如下:
class B extends A {
public static function factory() {
return A::factory( constant );
}
}
http://www.un.org。
你们试图压倒(和超载,有不同的参数)固定功能。
其共同错误假定固定方法是虚拟的,可以推翻。 有些方案语言允许(Object Pascal, Delphi),其他非专利(C#, Java),PHP取决于版本,我想。
为了诚实起见,“法定职能”的工作类似于具有名称空间的全球职能,可公开接触某类成员,而不是使用方法。 我建议将这些职能视为全球职能,始终如此。
Cheers.