note 39750 added to keyword.parent
| From: | bitmore dot co dot kr at rn2 dot php dot net | Date: | Mon, 09 Feb 2004 18:13:25 +0000 |
| Subject: | note 39750 added to keyword.parent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64900@lists.php.net to get a copy of this message | ||
/* Original */
/*
class A {
var $x;
function A() { $this->x = 32; }
function joke() { print "A::joke" . A::x . "<br>\n"; # SYNTAX ERROR!! }
}
class B extends A {
var $x;
function B() {
parent::A();
$this->x = 44;
}
function joke() {
parent::joke();
print "B::joke " . $this->x . "<br>\n";
}
}
echo A::joke();
echo B::joke();
*/
/* Original */
/* Modify */
/*
class A {
var $x;
function A() { $this->x = 32; }
function joke() {
$this = new A;
print "A::joke = " . $this->x . "<br>\n";
}
}
class B extends A {
var $x;
function B() {
parent::A();
$this->x = 44;
}
function joke() {
parent::joke();
$this = new B;
print "B::joke = " . $this->x . "<br>\n";
}
}
echo A::joke();
echo B::joke();
//print Show
A::joke = 32
A::joke = 32
B::joke = 44
*/
----
Manual Page -- http://www.php.net/manual/en/keyword.parent.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39750
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39750&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39750&report=yes
Search -- http://master.php.net/manage/user-notes.php