2,763
社区成员
发帖
与我相关
我的任务
分享
class Car
def go()
puts "汽車正在行駛";
end
def show
puts "展示汽車";
end
end
class BMWCar < Car
def go()
puts "BMW Runing";
end
def show(name) # 即使參數不同,一樣覆蓋
super()
puts "BMW正在展示 #{name} " ;
end
end
bmw= BMWCar.new();
bmw.go();
bmw.show("I9");