note 77999 added to language.oop5.static
| From: | nospam dot dd at dyce dot com | Date: | Sun, 23 Sep 2007 10:30:51 +0000 |
| Subject: | note 77999 added to language.oop5.static | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130710@lists.php.net to get a copy of this message | ||
Not sure if this gets around the static inheritance problem, but it does seem to work:
<?php
// Declare the interface 'iDomainProperties'
interface iDomainProperties {
static function property_setup();
}
// define superclass
class domainobject implements iDomainProperties {
protected $properties;
static function property_setup() { return array(); }
}
// define subclass
class person_object extends domainobject {
static function property_setup() {
$properties = array('type' => 'int', 'size' =>
'10');
return $properties;
}
}
// now ask for static function from person_object
print_r(person_object::property_setup());
?>
results in
Array
(
[type] => int
[size] => 10
)
----
Server IP: 87.124.64.96
Probable Submitter: 81.132.14.36
----
Manual Page -- http://www.php.net/manual/en/language.oop5.static.php
Edit -- https://master.php.net/note/edit/77999
Del: integrated -- https://master.php.net/note/delete/77999/integrated
Del: useless -- https://master.php.net/note/delete/77999/useless
Del: bad code -- https://master.php.net/note/delete/77999/bad+code
Del: spam -- https://master.php.net/note/delete/77999/spam
Del: non-english -- https://master.php.net/note/delete/77999/non-english
Del: in docs -- https://master.php.net/note/delete/77999/in+docs
Del: other reasons-- https://master.php.net/note/delete/77999
Reject -- https://master.php.net/note/reject/77999
Search -- https://master.php.net/manage/user-notes.php