Sobes.tech
Junior — Senior

Implementation of the Abstract Factory pattern for creating shapes

livecode

Task condition

It is necessary to implement the Abstract Factory design pattern, which allows obtaining objects that implement the Shape interface. The getInstance() method should return an instance of the required shape. The solution should be designed in such a way that it is easy to add new shape types without modifying existing code. For example, after adding a Pentagon class that implements Shape, the factory should be able to create its instances without modifications. Currently, the project already includes implementations for Cube and Triangle shapes.

public class ShapeFactory {

}