note 61346 added to function.get-class
| From: | ninja at hydracart dot com | Date: | Wed, 01 Feb 2006 05:08:12 +0000 |
| Subject: | note 61346 added to function.get-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102800@lists.php.net to get a copy of this message | ||
darkfalconIV at hotmail dot com, I agree that this should be solved it is silly they won't fix
it. Devs you should consider this type of scenario.
abstract class A
{
public function instance()
{
static $instance = NULL;
if(!isset($instance))
{
$instance = new get_class();
}
return $instance;
}
}
class B extends B
{
}
B::instance();
I don't want to add method instance() in all my children classes when a way should exist to
describe this in the parent and be inherited.
----
Server IP: 216.194.113.175
Probable Submitter: 70.189.105.186
----
Manual Page -- http://www.php.net/manual/en/function.get-class.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61346
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61346&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61346&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61346&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61346&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61346&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61346&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61346&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61346&report=yes
Search -- http://master.php.net/manage/user-notes.php