note 35942 added to language.oop.constructor
| From: | pigmeu at rn2 dot php dot net | Date: | Fri, 19 Sep 2003 19:30:46 +0000 |
| Subject: | note 35942 added to language.oop.constructor | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-56786@lists.php.net to get a copy of this message | ||
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?
----
Manual Page -- http://www.php.net/manual/en/language.oop.constructor.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35942
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35942&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35942&report=yes