Problems to solve:
In the system a,b,c three components must be used at the same time, but the same A1 and A2 of a have common features but are mutually exclusive, B,B1,B2 and C,C1,C2 are the same. For example, to create a system that can run in a Windows environment of different operating systems, there are Unixbutton and Unixtext,win underneath Unix, as well as Winbutton and Wintext, Unixbutton and Unixtext must be used in a system UNIX, and Winbutton and Wintext can only be used under win. But Winbutton and Unixbutton both have the same characteristics, such as after the press will trigger events, such as he has a text description and so on, but Winbutton and Unixbutton are not mixed.
Then this problem can be solved in an abstract factory:
How to choose to use Winbutton in abstract Factory mode, Wintext, have specific factory class winfactory to be responsible for, because they contain the logic that chooses the appropriate product object, so it is closely related to the business logic of the application system. The abstract factory class is responsible for defining interfaces, and he is the core of the abstract factory model.
And Winbutton/macbutton is a product family, there are common characteristics, their specific characteristics are abstract product class or interface to define and describe. But their specific implementation has a specific product class is responsible for, these are the end of what the client wants, so its internal must be full of application system business logic (triggering logic/style logic, etc.).
Class Diagram Structure: