[ACCEPTED]-Origin/Explanation of Class::getInstance?-oop

Accepted answer
Score: 16

It's quite simple. Looks, a lot like Zend 12 Framework thought?
Anyway, this implements 11 the Singleton design pattern. It's forbidding 10 the programmer to create more than one instance 9 of the controller. So, is you access your 8 controller from anywhere in your code, instead 7 of creating a new FrontController or something 6 like that you just ask to be given the One 5 instance that as been previously created.

If 4 no instance exist, it's creating one else 3 it only return you the front controller 2 wich as been previously created.


Hope this 1 helps you!

Score: 4

getInstance() comes from the Singleton pattern. You basically use this 2 when you want to instantiate no more than 1 one instance of a class.

More Related questions