Re: [问题] 继承失败?(附上测试用程式码)

楼主: AIGecko (师大猫耳控)   2013-02-04 15:41:49
附上能测试的程式码
只要改Option就能换继承宣告的位置
require 'sdl'
Option=0
proc=->{
class Surface < SDL::Surface
def initialize(w,h,format)
super(SDL::SWSURFACE,w,h,format)
end
end
}
Option==0 and proc.call
SDL.init(SDL::INIT_VIDEO)
Option==1 and proc.call
screen=SDL::Screen.open(640,480,32,SDL::SWSURFACE)
Option==2 and proc.call
pic=Surface.new(640,480,screen.format)
while true
event=SDL::Event.poll
case event
when SDL::Event::Quit
exit
end
SDL.delay(30)
end
不管在哪宣告都会失败
不过似乎有继承到
只是方法没有覆写上去

Links booklink

Contact Us: admin [ a t ] ucptt.com