note 21858 added to keyword.parent

From: Date: Wed, 29 May 2002 15:19:37 +0000
Subject: note 21858 added to keyword.parent
Groups: php.notes 
Request: Send a blank email to php-notes+get-31152@lists.php.net to get a copy of this message
This example might illustrate something which was unclear to me when using the $parent::method() syntax. I didn't see any documentation on whether or not $this (object variables) would be available in the parent class method so I wrote this example: class One { var $v = "one"; function OneDo() { print "One::OneDo " . $this->v . "<br>\n"; } } class Two extends One { function CallParent() { parent::OneDo(); } } $o = new Two(); $o->CallParent(); The output is "One::OneDo one", happy day! -- http://www.php.net/manual/en/keyword.parent.php http://master.php.net/manage/user-notes.php?action=edit+21858 http://master.php.net/manage/user-notes.php?action=delete+21858 http://master.php.net/manage/user-notes.php?action=reject+21858

« previous php.notes (#31152) next »