note 77999 deleted from language.oop5.static by felipe
| From: | felipe@php.net | Date: | Mon, 24 Mar 2008 23:14:25 +0000 |
| Subject: | note 77999 deleted from language.oop5.static by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137520@lists.php.net to get a copy of this message | ||
Note Submitter: nospam dot dd at dyce dot com
----
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
)