Download - The Abstract Factory groups part creation for a family of ...se362/PatternOverviews/AbstractFactory.pdf · The Abstract Factory groups part creation for a family of parts so the family

Transcript

1

1

The Abstract Factory groups part creation for a family of parts so the family can be changed.

§ Define an common interface for each family element that the application uses

§ Define a class that is responsible for creating all elements in the family via a factory method for each element

§ Application instantiates desired factory

2

MotifFactory

getWindow()getButton()

Win32Factory

getWindow()getButton()

Example: WidgetFactory

WidgetFactory

getWindow()getButton()

MotifWindowWin32Window

Window

MotifButtonWin32Button

Button