The Abstract Factory groups part creation for a family of...

Post on 05-Jun-2020

6 views 0 download

Transcript of The Abstract Factory groups part creation for a family of...

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