note 101309 added to language.oop5.late-static-bindings
| From: | jrfish dot x at gmail dot com | Date: | Thu, 09 Dec 2010 12:01:59 +0000 |
| Subject: | note 101309 added to language.oop5.late-static-bindings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174731@lists.php.net to get a copy of this message | ||
consider this:
class A
{
// some stuff....
public static function getInstance()
{
return new self();
}
}
class B extends A
{
//stuff...
}
$obj = B::getInstance();
//versus
class A
{
// some stuff....
public static function getInstance()
{
return new static();
}
}
class B extends A
{
//stuff...
}
$obj = B::getInstance();
----
Server IP: 69.147.83.197
Probable Submitter: 178.23.216.80
----
Manual Page -- http://www.php.net/manual/en/language.oop5.late-static-bindings.php
Edit -- https://master.php.net/note/edit/101309
Del: integrated -- https://master.php.net/note/delete/101309/integrated
Del: useless -- https://master.php.net/note/delete/101309/useless
Del: bad code -- https://master.php.net/note/delete/101309/bad+code
Del: spam -- https://master.php.net/note/delete/101309/spam
Del: non-english -- https://master.php.net/note/delete/101309/non-english
Del: in docs -- https://master.php.net/note/delete/101309/in+docs
Del: other reasons-- https://master.php.net/note/delete/101309
Reject -- https://master.php.net/note/reject/101309
Search -- https://master.php.net/manage/user-notes.php