3 ms·
...and now you know what a "factory method" is.
by stickfigure 7y ago
...and now you know what a "factory method" is.
- Koshkin 7y agoAlmost. One of the biggest advantages of a class factory is that it can return a pointer to an interface rather than a concrete class.
- inetknght 7y agoYes but that doesn't meaningfully change what a "factory" is: a factory returns an already-constructed object or smart-pointer-to-that-object you can work with. Whether or not that object is concrete or an interface to a hidden implementation is less important IMO.