0%
Class再入门
知识点
实战演习
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| class Game def initialize(id, title, price) @id = id @title = title @price = price end
def showGame puts @id + ", " + @title + ", " + @price.to_s end
def self.toStr puts "I love this game." end end
zelda = Game.new("zelda", "ゼルダの伝説", 350) zelda.showGame
Game.toStr Game::toStr
|