[ create a new paste ] login | about

Link: http://codepad.org/AdHFUEH6    [ raw code | output | fork ]

PHP, pasted on Feb 12:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

class Singleton {
    static public function getInstance() {
        return new self;
    }
}

class SuperSingleton extends Singleton {

}

$obj = SuperSingleton::getInstance();
var_dump($obj);


Output:
1
2
object(Singleton)#1 (0) {
}


Create a new paste based on this one


Comments: