4 ms·
Any sort of plugin architecture, e.g. VST audio plugins. Often there's an interface which you could implement directly, or you could inherit from an abstract cl
by dls2016 4y ago
Any sort of plugin architecture, e.g. VST audio plugins. Often there's an interface which you could implement directly, or you could inherit from an abstract class which provides some common functionality. I like this because it stresses that deep hierarchies aren't necessary to be useful. Also, if you're refactoring and see a "switch on type" then a little bit of inheritance is probably OK.
I admit I taught intro to C++ and used shapes as an example. I spent a few weeks building a little "ASCII render" thingy with a 80x30 "canvas" where each character is a pixel. Then you could place Shapes on the canvas and the shape would decide whether a given pixel was contained() inside of it.
I remember my first OO class where the car analogy was proven to be bad using the existence of the El Camino.
- cloogshicer 4y agoThanks for your suggestion!