Building a Singleton Database with Restrictive Constructors in PHP 5
In this third installment of a four-part series, I show you that a private constructor can be truly helpful when strictly implementing the Singleton design pattern. In this case, the pattern will be applied within a class that behaves like a simple MySQL abstraction layer, but the same concept can be extended to other classes.
- At first sight, declaring a constructor method protected or private in PHP 5 seems to be a rather irrelevant and even boring topic. The process doesnt differ too much from specifying one of those levels of restriction for a regular class method. However, this first impression may be misleading. ...
- At first sight, declaring a constructor method protected or private in PHP 5 seems to be a rather irrelevant and even boring topic. The process doesnt differ too much from specifying one of those levels of restriction for a regular class method. However, this first impression may be misleading. ...
