samedi 31 mars 2018

Factory-pattern for superclass and its subclasses

I have 3 classes wich are one child of the other: Class C ->(subclass of)-> class B ->(subclass of)-> class A.

Every class is real and I want to choose wich one to instantiate by a method. Can I use Factory-method and so factory-pattern to choose wich class to create?

tank you.

Aucun commentaire:

Enregistrer un commentaire