-
-
Save mistyrinth/70d3b007c1a6f9d4960f4ced781b598f 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 Pet | |
def initialize(petname) | |
@name = petname | |
end | |
def dispName | |
print(@name, "\n") | |
end | |
end | |
# オブジェクトの作成 | |
pet1 = Pet.new("Bella") | |
pet1.dispName | |
pet2 = Pet.new("Duke") | |
pet2.dispName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment