Skip to content

Instantly share code, notes, and snippets.

@uiur
Created June 2, 2013 10:59
Show Gist options
  • Save uiur/5693303 to your computer and use it in GitHub Desktop.
Save uiur/5693303 to your computer and use it in GitHub Desktop.
# encoding: UTF-8
class Pikachu
# インスタンス変数へのアクセサ
attr_accessor :hp, :attack, :defence
def initialize(hp, attack, defence)
# インスタンス変数に代入する
@hp = hp
@attack = attack
@defence = defence
end
# インスタンスメソッド
def denkishock
# なんかやる
end
# インスタンスメソッド
def denziha
# なんかやる
end
end
p = Pikachu.new(100, 10, 10)
puts p.hp
puts p.attack
p.denkishock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment