Created
October 1, 2009 20:25
-
-
Save adhusson/199218 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 Animal | |
attr_reader :name, :color | |
def initialize(name,color) | |
@name = name | |
@color = color | |
end | |
def self.create_felix(color) | |
# Is this how I should refer to the newly created instance of Animal? | |
this = self.new("common",color) | |
p this.color | |
end | |
end | |
red_felix = Animal.create_felix("red") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment