Carlos Medina wrote:
this is the Result of my test with your Code:
Fatal error: Access level to Singleton::__construct() must be public (as
in class Base) in C:\Users\cmedina\Documents\test1.php on line 30
Hmmm, that'll learn me for not running it first I sps :s
Well that is completely crap
> here is in my opinion, what you can do:
> class Base {
> private function __construct()
Except that in one of my follow up posts I indicated that my singleton
class was deriving from a class that had a public constructor.
Thanks anyway. I ended up just using Stut's suggestion. As he said,
it
Hi,
here is in my opinion, what you can do:
class Base
{
private $foo;
private function __construct()
{}
public function getFoo()
{
return $this->foo;
}
public function setFoo( $foo )
{
$this->foo = $foo;
}
}
class Singleton extends Base
{
public function __constr
Colin Guthrie schrieb:
Stut wrote:
On 20 Oct 2008, at 20:24, Christoph Boget wrote:
public function __construct()
A singleton would usually have a private constructor to prevent
non-singleton instances.
The problem being if the class in question derives from another class
that has a public
Stut wrote:
On 20 Oct 2008, at 20:24, Christoph Boget wrote:
public function __construct()
A singleton would usually have a private constructor to prevent
non-singleton instances.
The problem being if the class in question derives from another class
that has a public constructor... If you a
Christoph Boget wrote:
Ok, so why isn't this working as (I, at the very least) expected?
class singleTon
{
private static $thisObj = NULL;
private $thisProp = NULL;
public function __construct()
{
echo 'singleTon::__construct()';
if( !is_null( singleTon::$thisObj ))
6 matches
Mail list logo