看板 Ruby 關於我們 聯絡資訊
附上能測試的程式碼 只要改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 不管在哪宣告都會失敗 不過似乎有繼承到 只是方法沒有覆寫上去 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.36.118.105