I’m looking for bad examples of using inheritance. I’m not very creative so this was the best I could think of:
class Car : public Engine {}
A car has an engine, but it is not an engine.
This would probably work to explain the concept, but I believe there are more illustrative examples?
The “classic” example ;-):
A Stack is NOT a Vector.
If Stack extends Vector, you are able to insert/delete at every given index, whereas you should only be allowed to add/delete elements by pushing/popping.