如果我有一个基类 Base thing = null;
其中有一个子类 class Subclass extends Base
并且我将其作为 thing = new Subclass
调用方法,我将如何具体调用一个—但不在基地?前任。 Base
has only method()
Subclass
has method()
and specialMethod()
the method specialMethod()
is the一个我想打电话。
原文由 eyecreate 发布,翻译遵循 CC BY-SA 4.0 许可协议
如果你知道
thing
包含一个Subclass
,你可以这样做: