I have some code here where certain objects need to be very specifically customized, for example to pass particular parameters to particular functions. The natural assumption is to Extend their types, overriding the necessary methods.
However, there is something to complicate this: Only one single instance of that extending type would be created! Seems kind of a waste to define a whole new Type just to create a single new instance and forget about it.
The alternative way is to have stuff like a factory method that runs a callback function. This way, every instance is of the exact same Type and all of the customization is happening with callbacks.
(I hope that made some sense...)
I can't decide which way is the best way. One has global functions and pointers all over the place, the other has extended types that hardly do anything.
However, there is something to complicate this: Only one single instance of that extending type would be created! Seems kind of a waste to define a whole new Type just to create a single new instance and forget about it.
The alternative way is to have stuff like a factory method that runs a callback function. This way, every instance is of the exact same Type and all of the customization is happening with callbacks.
(I hope that made some sense...)
I can't decide which way is the best way. One has global functions and pointers all over the place, the other has extended types that hardly do anything.