Name: Anonymous 2011-11-21 12:54
Sup /prog/, self-learning programmer here. I have a question with inheritance. Say that I have a class called Food with an attribute "name" and "weight". Do I have to make subclasses with each type of food I will use (ie. apple is-a food, hence I need to make an apple subclass) or do I just instantiate a new food and call it apple? Note that I won't specifically give "apple" new attributes/methods, but I will make entities of it (ie. a person has 3 apples and 2 oranges blabla)
I realize this is a simple question but I'm a fucking baffled moron and can't seem to solve it.
I realize this is a simple question but I'm a fucking baffled moron and can't seem to solve it.