- Get link
- X
- Other Apps
In Abstract Factory pattern an interface is responsible for creating a factory of related objects without explicitly specifying their classes. Each generated factory can give the objects as per the Factory pattern. Abstract Factory is Factory within factory. Its come under creational Design Pattern in java Example: Step à 1.create interface Shape.java Public interface Shape { Public void drawshape(); } Color.java Public interface Color { Public void setcolor(); } Step à 2.implments shape Rectangle.java Public Class Rectangle implements Shape { void drawshape() { System.out.println(“Rectangle drwn”); } } Circle.jva Public Class Circle implements Shape { void drawshape() { System.out.println(“Circle drwn”); } } Step.3 à implements color Interface Red.java Public class Red implements Color { ...