4 ms·
> a factory can vary the return type, unlike a plain constructor That's a language limitation and has nothing to do with the design pattern. You can do this j
by 1718627440 1y ago
> a factory can vary the return type, unlike a plain constructor
That's a language limitation and has nothing to do with the design pattern. You can do this just fine e.g. in Python.
- idontwantthis 1y agoYou could do that more or less in Javascript by creating and initializing different member variables in the constructor depending on a constructor argument but I would hate you for it.