jeudi 9 juin 2016

Singleton design pattern in PHP

I have a question about singleton design pattern. When we apply singleton for our class, we need to set class' constructor private so we can not instantiate the class normally, but we also instantiate it in class context (if the object we need doesnt exist). The question is why dont private constructor prevent us from instantiate class in class context?

Aucun commentaire:

Enregistrer un commentaire