A factory method is a method that instantiates an object and returns it. And in a singleton, it must have such a factory method.
So can I say that Singleton pattern is an example of a factory method pattern?
Another example of factory method pattern is of course to return different subclasses of the method's return type.
r**u 发帖数: 130
2
why bother playing with this "words"? they are for different purposes. It
makes no sense to call a Singleton pattern as a Factory pattern.