I’m often faced with a choice between: 1. Adding a...
# announcements
m
I’m often faced with a choice between: 1. Adding a constructor argument that accepts a lambda 2. Making the class abstract and adding an abstract function Are there any clear advantages of one over the other? Note: the class does not otherwise need to be subclassed.
n
In the latter case won't you need a concrete derived class?
I'd say that 1 is significantly better, regardless
Not knowing other details
Classes are typically constructed once, used many times. The first only complicates the construction site. The second however complicates understanding its usage
m
So perhaps abstract functions only need to be considered when polymorphism is truly required. i.e. not when you only require the instantiator to fill in some functionality.