这种在运行时的类切换是面向对象编程的一个常见特性,称为多态性。
This switching of classes at run time is a common feature of object-oriented programming, known as polymorphism.
它允许利用多态性在运行时换出一个不同的类来公开相同的方法。
This allows you to swap out at runtime a different class exposing the same methods, taking advantage of polymorphism.
利用类的继承和多态特性,程序代码简洁,运行速度快。
By using characteristic of inheritance and encapsulation, code of programmer is more succinct, and speed of running is faster.
应用推荐