[fxruby-users] method call question

chen li chen_li3 at yahoo.com
Mon Oct 27 13:53:14 EDT 2008


Hi all,

I am new to FxRuby. I am learning it by studying some code samples. Now I am confused about a method call in the following script:  which class  defines method  create, class FXApp or HelloWindow/FXMainWindow? Based on the code, class HelloWindow/FXMainWindow defines method 'create'. If this is true , the object from this class can response to the message. But here why does an object created by a different class FXApp response to method 'create'?

Thanks,

Li






require 'fox16'

include Fox

class HelloWindow < FXMainWindow
  def initialize(app)
    super(app, "Hello, World!", :width => 200, :height => 100)
  end

  def create
    super
    show(PLACEMENT_SCREEN)
  end
end

app = FXApp.new
HelloWindow.new(app)
app.create
app.run


      


More information about the fxruby-users mailing list