Class ConcreteCreatorB

java.lang.Object
Creational.FactoryMethod.Creator
Creational.FactoryMethod.ConcreteCreatorB

public class ConcreteCreatorB extends Creator
Concrete implementation of the Creator class. ConcreteCreatorB is responsible for creating instances of ConcreteProductB. It overrides the factory method (`createProduct`) to instantiate and return the specific product type (ConcreteProductB).
  • Constructor Details

    • ConcreteCreatorB

      public ConcreteCreatorB()
      Default constructor for ConcreteCreatorB.
  • Method Details

    • createProduct

      public Product createProduct()
      Factory method implementation for creating ConcreteProductB. This method overrides the abstract factory method in the Creator class to provide a specific implementation that returns an instance of ConcreteProductB.
      Specified by:
      createProduct in class Creator
      Returns:
      A new instance of ConcreteProductB.