[UPHPU] Objected Oriented question
Justin Giboney
giboney at giboneydesigns.com
Mon Sep 17 15:00:16 MDT 2007
I am trying to wrap my head around object oriented programming, but I
am having a difficult time trying to figure out how to code something
like this....
A car manufacturing company makes multiple models of cars (like,
Toyota: Sienna, Tundra, Camry). Each model has a low end, medium end,
and high end version. Each version has a set of options it can choose
from.
Here are my thoughts:
There are at least two classes here (car and option), but I don't
know wether to make subclasses of each of the models. Then do I make
subclasses of each of the models for low, medium, and high end?
I could create an array in each of the subclasses for each of the
options available, but what if there are a hundred options?
What if an option provides more options (like, if you get leather
seats, then you can get them heated if you like)?
More information about the UPHPU
mailing list