Extending a singleton class

Posted by cakyus on Stack Overflow See other posts from Stack Overflow or by cakyus
Published on 2010-04-06T12:54:50Z Indexed on 2010/04/06 13:43 UTC
Read the original article Hit count: 489

Filed under:
|
|
|
|

i used to create an instance of a singleton class like this:

$Singleton = SingletonClassName::GetInstance();

and for non singleton class:

$NonSingleton = new NonSingletonClassName;

i think we should not differentiate how we create an instance of a class whether this is a singleton or not. if i look in perception of other class, i don't care whether the class we need a singleton class or not. so, i still not comfortable with how php treat a singleton class. i think and i always want to write:

$Singleton = new SingletonClassName;

just another non singleton class, is there a solution to this problem ?

© Stack Overflow or respective owner

Related posts about php

Related posts about php5