Design Patterns

Singleton Class

The Singleton pattern ensures that a class has only one instance and ensures access to the instance through the application. It can be useful in cases where you have a "global" object with exactly one instance.

Factory Method

The Factory Method offers an interface for creating an instance of a class, with its subclasses deciding which class to instantiate.

You might want to implement this with the creator class being abstract and not providing an implementation for the Factory method.

Or, you could have the Creator class be a concrete class that provides an implementation for the Factory method. In this case, the Factory method would take a parameter representing which class to instantiate.

https://www.tutorialspoint.com/object_oriented_analysis_design/ooad_object_oriented_model.htm

results matching ""

    No results matching ""