jeudi 31 mars 2016

How to allow Object creation of a class on only particular classes in PHP?

In PHP, let there be four classes A, B, C, and D. None of them inherits the other. They are all independent classes. Now, I want only B and C to be able to create Objects of the class A. D Should not be able to create the Object of class A.

Can this be done in PHP? If So, how? I tried refreshing my object oriented concepts, but can't seem to find an appropriate answer in PHP.

Little help would be much appreciated.

Aucun commentaire:

Enregistrer un commentaire