note 35942 deleted from language.oop.constructor by danbrown
| From: | danbrown@php.net | Date: | Sat, 07 Nov 2009 18:57:51 +0000 |
| Subject: | note 35942 deleted from language.oop.constructor by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162534@lists.php.net to get a copy of this message | ||
Note Submitter: pigmeu at pigmeu dot net
----
To workaround the problem that some people are having on multiple creator (or sub creators or
whatever)...
Its just to use an event! Yes... U can emulate an event (like the inprize people do)
Here it goes:
<?
//This is the "generic" class... All other classes may extends from it...
class TObject {
function On_Create() { }
function TObject() {
$this->On_Create();
}
}
class TExtendedObject extends TObject {
var $name;
function On_Create() {
$this->name = "Test";
}
}
$t_class = new TExtendedObject;
echo $t_class->name;
/* output
Test
*/
?>
Nice... Isn't it?