When you have such a class structure:
A1, A2, ..., AN inherited from AB1, B2, ..., BN inherited in B ... K1, K2, ..., KN inherited in K
In the case of Condition_i, use Xi, and management will be difficult when n> = 2, so constructing such a factory 'to be responsible for Condition:
COND1, COND2, ..., CONDN inherits in COND
With Condi, you can generate AI, BI, ..., KI, and their users only need to know Cond, A, B, ..., K, without knowing specific i. Here Cond is the so-called Abstract Factory.
Switches May Indicate a NEED for Abstract.
Intent: You Want to Have Families Or Sets of Objects for Particular Clients.
Problem: Families of Related Objects Need To BE Instantiated
Using the Abstract Factory Is Indicated WHEN The Problem Domain Has Different Families of Objects Presentan Each Family Is Used Under Different Circumstances.
If you use java, the class class will do the job.