Created
July 16, 2010 09:57
-
-
Save johobemax/478195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MusicPlayer | |
attr_accessor :music, :volume | |
def play() | |
puts "#{@music}を再生します" | |
end | |
def stop() | |
puts "#{@music}を停止します" | |
end | |
def volumeChange(v) | |
@volume = v | |
puts "音量を#{volume}に変更しました" | |
end | |
end | |
ply = MusicPlayer.new | |
ply.music = "ドラえもんの歌" | |
ply.play | |
ply.stop | |
ply.volumeChange 20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MusicPlayerのRuby版。
http://gist.github.com/478002 と
どっちがわかりやすい?