Posted by helper on December 05, 2001 at 10:19:53:
In Reply to: question about hierarchy - possible loss of points? posted by Kristie on December 05, 2001 at 09:51:39:
: just a question to clarify something before being satisfied with having turned in my program.
: i originally had a vehicle base class which served as the base for a car and a towtruck. however, in doing this, i had to make a function used in only the towtruck class pure virtual and so the car overrid the function, but didnt do anything. i was told it was a bad idea to have a function that isnt overriden in all its derived classes.
: so then i changed it to where car is its own class... not derived... and to where the towtruck is the base class for the three trucks, but is not derived from anything. - will i lose points for not having the vehicle base class for both car and truck?
: if so... how which function should i have overriden because it was mentioned that the license for the car and the id for the trucks are not related so you couldnt do the "getid()". on the other hand, you could use the "getlocation()," but it was also stated that the car need not have a location since it doesnt need to know where it is.
: so basically... the problem is this - do we have a vehicle base class for which car and towtruck are derived from ( if so, which function should get overloaded ), or can we just start with a car and a towtruck class?
: any help would be great. thanks.
Post a Followup