note 61286 added to language.oop5.decon
| From: | jochemATmondrian-itd_o_tnl at osu1 dot php dot net | Date: | Mon, 30 Jan 2006 12:07:27 +0000 |
| Subject: | note 61286 added to language.oop5.decon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102723@lists.php.net to get a copy of this message | ||
at: derk AT oneindig DOT com
You can achieve identical functionality by doing this:
<?php
class Parent {
function __construct()
{
echo "Parent constructor called\\n";
}
}
class Child extends Parent {
function __construct()
{
parent::__construct();
echo " Child 'contructor' called";
}
}
$c = new Child();
?>
Added advantage is that Parent doesn't need to have the method myConstruct(), and that
you're using constructors like they were intended.
----
Server IP: 83.137.20.120
Probable Submitter: 62.216.7.185
----
Manual Page -- http://www.php.net/manual/en/language.oop5.decon.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61286
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61286&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61286&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61286&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61286&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61286&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61286&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61286&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61286&report=yes
Search -- http://master.php.net/manage/user-notes.php