虚方法调用(Virtual Method Invocation):在多态情况下,一个引用类型的变量如果声明为父类的类型,但实际引用的是子类对象,则该变量就不能再访问子类中添加的属性和方法...
基于28个网页-相关网页
A virtual method invocation, for example, involves looking at the class of the receiver object for the call to discover which actual target implements the virtual method for the receiver object.
例如,一个虚方法调用需要查看接收方对象的类调用,以便找出哪个实际目标实现了接收方对象的虚方法。
Just as developers do not worry about the overhead of a virtual method dispatch, they will not worry about the invocation overhead of advice.
就像开发人员不该担心虚拟方法分派的开销一样,他们也不用担心通知的调用开销。
Of course, if the class hierarchy changes and a second target method becomes possible, then the JIT compiler can correct the originally generated code so that the virtual invocation is performed.
当然,如果类层次结构发生变化,并且出现另外的目标方法,则JIT编译器可以更正最初生成的代码以便执行虚调用。
应用推荐