正在加载图片...
Var toi to= a+ b Endfunc; maIn BeginFuncWithParams vvv t1 =LCall foo(c, d) Now for a class example with both fields and methods(notice how this is passed as a secret first parameter to a method call) class Animal int height void InitAnimal(int h)( this height =hi class Cow extends Animal I void InitCow(int h) InitAnimal(h)i void binky(class Cow betsy) t betsy. InitCow(5) Animal InitAnimal BeginFuncWithParams this, hi EndFunc: VTable Animal Animal InitAnimal Cow工 ni tcow BeginFuncWithParams this, h to =*(this) t1=*(t0) ACall tl(this, h)i vTable Cor Animal InitAnimalVar _t0; _t0 = a + b; Return _t0; EndFunc; main: BeginFuncWithParams; Var c; Var d; Var _t1; _t1 = LCall _foo(c, d); EndFunc; Now for a class example with both fields and methods (notice how this is passed as a secret first parameter to a method call) class Animal { int height; void InitAnimal(int h) { this.height = h; } } class Cow extends Animal { void InitCow(int h) { InitAnimal(h); } } void Binky(class Cow betsy) { betsy.InitCow(5); } __Animal_InitAnimal: BeginFuncWithParams this, h; *(this + 4) = h; EndFunc; VTable Animal = __Animal_InitAnimal, ; __Cow_InitCow: BeginFuncWithParams this, h; Var _t0; _t0 = *(this); Var _t1; _t1 = *(_t0); ACall _t1(this, h); EndFunc; VTable Cow = __Animal_InitAnimal
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有