89.
Which design pattern does this implement
class SkinFactory
{
void Config(string whichSkin){}
IButton CreateButton() {}
IPanel CreatePanel() {}
}
class WindowsSkins:SkinFactory
{
IButton createWindowsThemeBtn() {}
IPanel createWindowThemePnl() {}
}
class MotifSkins:SkinFactory
{
IButton createMotifThemeBtn() {}
IPanel createMotifThemePnl(){}
}
main()
{
SkinFactory skins = new SkinFactory();
skins.Config("Motif");
skins.CreateButton();
skins.CreatePanel();
}
View Description
SkinFactory is a class which creates a family of related objects - in this case Windows Themed Controls and Motif Themed Controls. Hence this is an example of Abstract factory.