I've been lately thinking over design principles and patterns and a question did strike me.Let us say, I want to design a racing game. I want to design the classes for a variety of cars.each car may have different featurethe most common features can be put in the base class - 'Car'Now, I learned that you should always strive to work with abstractions.All the code that tries to manipulate the car will try to call the abstract methods on Car like Car.Accelerate(), Car.TurnLeft(), etc...But what about the specific features? Like some cars might have rocket thrusters or a parachute and you might want to use them (I know this sounds ridiculous, but my point here is 'There might be special features in derived classes that might not justify the actual type(or base type) of that specific class')?So, what about them?Would you rather raise few more abstract methods in base class making it less cohesive, or would you put some if blocks and type casts (to get the actual class object and use that method) making it more coupled?
putting methods in base class that doesnt make sense/belong there
object oriented;object oriented design;design principles