Suppose there are several presses, each one published many books I am going to handle many records like 'press name, book name'
I want create the class 'Press' by a unique name(string), but only different string can produce different instances of class 'Press'.
so, I need a class work like 'factory', create a new instance when a record contains a new press, but it also work as singleton if there are already exists which has the same names.
Aucun commentaire:
Enregistrer un commentaire