3 ms·
That's a very interesting thought and I have a gut feel he's onto something. Last two times I used subclasses were in case of a C++ library that was designed v
by strlen 17y ago
That's a very interesting thought and I have a gut feel he's onto something.
Last two times I used subclasses were in case of a C++ library that was designed very much like twisted (except it used threading a great deal more): there were events coming from epoll() and going to a pool of worker threads.
I subclassed this framework to create my own asynchronous network server. However, that got me thinking: wouldn't this have been better implemented using callbacks?
The other time I've used subclassing was in Java with the "decorator" pattern: I needed to extend the functionality of object foo, while still allowing any subclasses of foo to behave as they normally would. However, the Scala approach to this (mixing in traits) seems a great deal more elegant.