Posted by Charles Hannum Jr on November 27, 2001 at 21:17:14:
In Reply to: That is my problem posted by Christopher Rubeiz on November 27, 2001 at 19:06:31:
I would consider his reply as a semi-red herring. He is right in that this design project does not involve the car class from spec because it is certainly not a type of towtruck, but I don't know why he gave the implication that both cars and towtrucks are vehicles (or other appropriate base class).
You could potentially waste your time designing a vehicle class with _one_ common field (the id) with the two set and get functions for id and from that derive a base towtruck and from that derive the specific towtrucks. However, that is hardly a logical use of inheritance - if the only common element between towtrucks and cars is a single string field (at least in my implementation) then they aren't really good candidates for a base class between them. I plan on skipping the "inheritance abuse" of this approach and start at the base towtruck.
Post a Followup