Hi!
Stroustrup says, that one must consider different levels of abstraction. You (SupSuper) said, you'd need to implement all of those other companion functions. This is not entirely true since those functions don't share the same level of abstraction.
accelerate() means, that the plane accelerates. How it does so, depends entirely on the plane and therefore on your implementation of that plane. For example, when accelerating, it might also increase fuel consumption as well.
accelerate() might call the private functions setSpeed() and setFuelConsumption()
move(position) and stop() could call accelerate() or brake() then
Another problem is code duplication. Let's say you really want to only change speed of your plane. Ok, no problem (yet). This would be:
plane.getSpeed();
- change speed here -
plane.setSpeed();
Three simple lines which might be copy & pasted everywhere they become necessary. But now you already choosed one implementation and this will constrain you in the future (and may cause some refactoring). What do you do, if you want to change speed slowly (interpolated)?
- You'd need to change those three lines everywhere in your code. Maybe it would become 5 lines now or even more.
- You might forget some locations
- You might later fix a bug in these 5 lines and forget some code locations
- Consider adding extra features like setting fuel consumption (another 3 lines to add everywhere)
Apart from that I think addSpeed() isn't a good idea (as Daiky pointed out already).