正在加载图片...
Now for a class example with both fields and methods(notice how this is passed as a secret first arameter to a method call) class Animal Animal. InitAnimal int height Beginfunc; void InitAnimal(int h)( *(this 4)=h this height =h Endure class Cow extends Animal Beginfunc void InitCow(int h)i InitAnimal(h) 1=*(_t0 P1 Push void binky (class Cow Endfunc betsy. Initcow(5) VTable Cow Cow. Initcow, Beginfunc; t2=5 t3 =*(betsy) PushParam tli PushParam betsy Ende6 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: BeginFunc; *(this + 4) = h; EndFunc; VTable Animal = _Animal.InitAnimal, ; _Cow.InitCow: BeginFunc; _t0 = *(this); _t1 = *(_t0); PushParam h; PushParam this; ACall _t1; EndFunc; VTable Cow = _Animal.InitAnimal, _Cow.InitCow, ; _Binky: BeginFunc; _t2 = 5; _t3 = *(betsy); _t4 = *(_t3 + 4); PushParam _t1; PushParam betsy; ACall _t4; EndFunc;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有