interface Button { /* ... */ } interface TextBox { /* ... */ } interface GUIFactory { public Button createButton(); public Window createTextBox(); // ... } class WinButton implements Button { /* ... */ } class WinTextBox implements TextBox { /* ... */ } class WinFactory implements GUIFactory { public Button createButton() { return new WinButton(); } public TextBox createTextBox() { return new WinTextBox(); } // ... }