Search the Community
Showing results for tags 'avoid'.
Found 2 results
how to prevent a class to be instantiated?
Rommeo posted a topic in PHP Coding HelpHello, My first question is; if there is a class, and i dont want this class to be instantiated anywhere? How can i do this? What are the ways/keywords for this? My second question is; Are there type of classes that can't be instantiated? What are the names of these classes? Thanks in advance.
Disallow cloning in PHP?
Vlades posted a topic in PHP Coding HelpHello, Is there any way to disallow the use of "clone " for an object? What I mean is, let's say I have a class named "user" I am able to clone the object ; $student = new user(); $teacher = clone $student; Is there any keyword that does not allow me to clone the "$student" object? Thank you in advance