Call constructor from parent class : super « Class « Ruby
- Ruby
- Class
- super
Call constructor from parent class
class Button
def initialize(label)
end
end
class StartButton < Button
def initialize
super("Start") # invoke Button's initialize
end
def button_pressed
# do start actions...
end
end
start_button = StartButton.new
Related examples in the same category