As I anderstand:
The abstract factory pattern provides an interface for
creating a family of objects whereas factory method
provides an interface for creating one object.
If this is only difference between these patterns why they are being considered separately?
The factory method is fixed – you can’t change it at runtime.
Abstract factory allows you to create objects with a different factory, which can be selected at runtime, depending on some criteria.
on the 2nd like this can be
WinButtonFactory extends ButtonFactoryorMacOSXButtonFactory extends ButtonFactory. You can pass one or the other depending on the current OS.