This is another useful engineering abstraction that can impose extra lookups and method dispatch, hurting performance.
这是另一种有用的工程抽象方法,但该方法增加了额外的查询和方法分配,损害了性能。
However, there could be a price to pay in terms of performance. There is (potential) overhead in object creation and in method dispatch.
但是,这可能会以牺牲性能为代价,对象创建和方法分配都可能会存在开销。
Inheritance is a coupling mechanism: it binds two entities together with well-defined rules about visibility, method dispatch, and so on.
继承是一个耦合机制:它使用关于可见性、方法调度等定义明确的规则绑定两个实体。
Method dispatch starts by calling a static "ClassOf" method with the object as argument.
方法调度通过把对象作为参数,来调用一个名为“ClassOf”的静态方法予以实现。
Method dispatch starts by calling a static "ClassOf" method with the object as argument.
方法调度通过把对象作为参数,来调用一个名为“ClassOf”的静态方法予以实现。
应用推荐