BasestaticGet()
DeriveddynamicGet()
Glyph()beforedraw()
RoundGlyph.draw().radius=0
Glyph()afterdraw()
RoundGlyph.RoundGlyph().radius=5
(1)在其他任何事物产生之前,将分派给对象的存储空间初始化成二进制0;
(2)挪用基类机关函数。从根入手下手递回下往,由于多态性此时挪用子类掩盖后的draw()办法(要在挪用RoundGlyph机关函数之前挪用),因为步骤1的原因,我们此时会发明radius的值为0;
(3)按声明按次挪用成员的初始化办法;
(4)最初挪用子类的机关函数。
sup.filed=0,sup.getField()=1
sub.filed=1,sub.getField()=1,sub.getSuperField()=0
Classname:rtti.FancyToy,isinterface?[false]
Simplename:FancyToy
Canonicalname:rtti.FancyToy
Classname:rtti.HasBatteries,isinterface?[true]
Simplename:HasBatteries
Canonicalname:rtti.HasBatteries
Classname:rtti.WaterProof,isinterface?[true]
Simplename:WaterProof
Canonicalname:rtti.WaterProof
Classname:rtti.Shoots,isinterface?[true]
Simplename:Shoots
Canonicalname:rtti.Shoots
Classname:rtti.Toy,isinterface?[false]
Simplename:Toy
Canonicalname:rtti.Toy
欢迎光临 仓酷云 (http://ckuyun.com/) | Powered by Discuz! X3.2 |