Ughhh, this is making my head hurt. Now I have to respond, you've forced my
hand. :)
I don't think you want to use inheritance like that. At this point, I'm not
sure you want to use inheritance at all. You get variety in your data, but
you don't need to commit that to your class structure. You have vehicle
models with options, and each option has many choices and an associated
cost. That's all you really need.
I would approach it more like this:
model
- features (collection)
- feature
- options (collection)
- option
So my Camry has features of wheels and paint color. But I probably have
different features for a Silverado truck. The Camry's options for wheels
are aluminum and steel, and the options for paint are black, silver, red,
and green. The wheel options have different costs, but the paint options
probably don't.
Now, you may be thinking that there are different features and options for
the different models of Camry (Camry, Camry LE, Camry SE, Camry XLE, and
Camry Hybrid). So add a line called Camry and put those models with their
available features under the line. You can even put the lines under the
manufacturer.
manufacturer "Toyota"
- lines (collection)
- line "Camry"
- models (collection)
- model "Camry Hybrid"
- features (collection)
- feature "Paint"
- options (collection)
- option "Green", $0
You may also want to do a search for "bill of material" and follow some of
those best practices.
~Mike
P.S. And check out my Podcast! (I need the traffic.)
http://rubiverse.com/
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net