I want to create a class that can use one of four algorithms (and the algorithm used is known only at runtime). I thought the strategy design template sounds appropriate, but my problem is that each algorithm requires several different parameters. It would be a bad design to use a strategy, but pass the appropriate parameters to the constructor ?.
Here is an example (for simplicity, let's say there are only two possible algorithms) ...
class Foo { private:
c ++ inheritance design-patterns strategy-pattern
Mewzer
source share