Created
September 18, 2017 11:23
-
-
Save LewisYoul/b95e0cc1adbe47616089fa4652f8b2d3 to your computer and use it in GitHub Desktop.
Class Example 1
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 Dog | |
attr_accessor :name, :breed, :age | |
def initialize (name, breed, age) | |
@name = name | |
@breed = breed | |
@age = age | |
end | |
def bark | |
puts "BARK BARK BARK!" | |
end | |
end | |
lewis = Dog.new "Lewis","Dalmation",28 | |
puts lewis.inspect | |
#<Dog:0x00556757f99138 @name="Lewis", @breed="Dalmation", @age=28> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment