C
Chad Murphy
Here is what I'm trying to do
class List
# Method item
# Pushes an item into an array @items
# Method to_s
# returns elements within @items into a string
end
class Groceries < List
item :lettuce
item otato
item :ham
end
print Groceries.new
The trouble I'm having is figuring out how to go about adding an
instance variable, which is an array, and will be updated using these
attr like methods (I don't know what these are called which is giving me
some trouble). Is this possible to pull off?
class List
# Method item
# Pushes an item into an array @items
# Method to_s
# returns elements within @items into a string
end
class Groceries < List
item :lettuce
item otato
item :ham
end
print Groceries.new
The trouble I'm having is figuring out how to go about adding an
instance variable, which is an array, and will be updated using these
attr like methods (I don't know what these are called which is giving me
some trouble). Is this possible to pull off?