When it comes to this kind of difference, the answer can always be yes or no. Design patterns are not a specific specification, they are more like a set of best and recommended practices, and their implementation varies from case to case.
In my opinion, the answer is no, technically it will not be a factory pattern. And this is not necessary as long as it solves your use case and makes the code readable and maintainable (trying to literally stick to design patterns often leads to their misuse and excessive architecture).
If we look at the Abstract factory template (right below the factory template on the linked page), we will see that it is a factory for creating factories. Suppose now that we have two Shape factories that AbstractFactory can create: ShapeFactory2D and ShapeFactory3D , producing Shape objects.
If Shape was an abstract class, then you would force both 2D and 3D objects to inherit the same implementation, although this may not make sense (they can be implemented in completely different ways).
So, technically, in order for this to really be a factory pattern, there should be no assumptions about implementation details, that is, abstract classes containing a partial implementation should not be used at the factory interface level.
Of course, you can have Abstract2DShape and Abstract3DShape abstract classes that implement Shape ; The fact is, you can create and use a Shape without knowing whether it is a 2D or 3D shape.
Dragan bozanovic
source share