Perhaps you meant something like
class Pet
attr_accessor :name, :age, :gender
end
class Cat < Pet
end
where Cat is a derivative of Pet ?
What you have doesnt make very much sense. you create two distinct classes and then try to create another class (of the same name) and have a relationship between them. You need to associate the super/sub class relationship when you create the class the first time otherwise you get this ambiguity you are seeing.
L7Sqr
Practically a Posting Shark
851 posts since Feb 2011
Reputation Points: 253
Solved Threads: 155
Skill Endorsements: 7
The sub class inherits all attribute from the parent. For instance:
class Pet
attr_accessor :name
end
class Cat < Pet
end
c = Cat.new
c.name = "Freddy" # <= Okay
c.weight = 32 # <= Error, no method defined
L7Sqr
Practically a Posting Shark
851 posts since Feb 2011
Reputation Points: 253
Solved Threads: 155
Skill Endorsements: 7