note 40399 added to keyword.extends
| From: | efredin at redtempest dot com | Date: | Tue, 02 Mar 2004 22:35:11 +0000 |
| Subject: | note 40399 added to keyword.extends | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66129@lists.php.net to get a copy of this message | ||
It is possible to override a method innherited from a parent class by simply re-defining the method
(for those of us who enjoy using abstract classes).
<?
class A
{
var $foo;
function A()
{
$this->foo = "asdf";
}
function bar()
{
echo $this->foo." : Running in A";
}
}
class B extends A
{
function bar()
{
echo $this->foo." : Running in B";
}
}
$myClass = new B;
$myClass->bar();
?>
----
Manual Page -- http://www.php.net/manual/en/keyword.extends.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40399
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40399&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40399&report=yes
Search -- http://master.php.net/manage/user-notes.php