4 ms·
Who on Earth writes a Bike class? I've seen whole arguments about whether Car should inherit from Vehicle and all this rubbish, all because people are taking va
by CodeMage 17y ago
Who on Earth writes a Bike class? I've seen whole arguments about whether Car should inherit from Vehicle and all this rubbish, all because people are taking vague and non-realistic examples, then getting tangled when they try and realise them.
While I agree with your point, I don't think the problem has anything to do with Bike, Car and Vehicle as a choice of classes and that files, windows, threads and connections are guaranteed to be used any better. The problem is that people who use these classes as an example don't put them in the context of a concrete domain. I'm pretty sure that I would write a Bike (or Bicycle) class myself if I was developing a bicycle racing game. So the advice to the authors should be to choose a problem domain (hopefully something fun) and stick to it. Whether Car inherits from Vehicle or User implements Principal depends, ultimately, on the problem domain.