note 87154 added to language.oop5.visibility

From: Date: Fri, 21 Nov 2008 19:50:57 +0000
Subject: note 87154 added to language.oop5.visibility
Groups: php.notes 
Request: Send a blank email to php-notes+get-146801@lists.php.net to get a copy of this message
To odessa-gun at ya dot ru Sorry but the example is totally right. In your code you just declare a new private member. It is not the original one that you modify. Try this to understand : <?php class MyClass { public $public = 'Public'; protected $protected = 'Protected'; private $private = 'Private'; function printHello() { echo $this->public; echo $this->protected; echo $this->private; } } class MyClass2 extends MyClass { public $public = 'Public2'; protected $protected = 'Protected2'; private $private = 'Private2'; function printHello() { // I have just added this to your code parent::printHello(); //Accessing the overridden method. This will explain better than me ;) echo $this->public; echo $this->protected; echo $this->private; } } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 83.193.39.96 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.visibility.php Edit -- https://master.php.net/note/edit/87154 Del: integrated -- https://master.php.net/note/delete/87154/integrated Del: useless -- https://master.php.net/note/delete/87154/useless Del: bad code -- https://master.php.net/note/delete/87154/bad+code Del: spam -- https://master.php.net/note/delete/87154/spam Del: non-english -- https://master.php.net/note/delete/87154/non-english Del: in docs -- https://master.php.net/note/delete/87154/in+docs Del: other reasons-- https://master.php.net/note/delete/87154 Reject -- https://master.php.net/note/reject/87154 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146801) next »