On 17 Sep 2007, at 15:00, Justin Giboney wrote:
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)?
Justin, I know this thread is several weeks old, but I never saw a
reply from you to the responses you got. Did your question get
answered? When doing any programming that I have a hard time
wrapping my mind around I resort to pseudo-code and basically talk
the problem out to myself in common english. Then I can take the
results and organize it however I need to and convert it to the
syntax of whatever language I am writing in. Although, before I do
any code, for something like this, where a database could be used, I
usually model the database first.
Jonathan
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net