note 104738 added to language.oop5.visibility
| From: | zara at osu1 dot php dot net | Date: | Mon, 04 Jul 2011 15:05:24 +0000 |
| Subject: | note 104738 added to language.oop5.visibility | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181227@lists.php.net to get a copy of this message | ||
class ParentClass
{
private $foo;
public function __construct()
{
$this->foo = 'foo';
}
public function foo()
{
echo $this->foo;
}
}
class ChildClass1 extends ParentClass
{
public function bar()
{
echo $this->foo;
}
}
$foo is PRIVATE, it's NOT available in ChildClass1.
As a result
$child1->bar(); // "Notice: Undefined property: ChildClass1::$foo in [file] on line
[line]"
makes perfect sense...
kr, zara
----
Server IP: 69.147.83.197
Probable Submitter: 195.227.7.165
----
Manual Page -- http://www.php.net/manual/en/language.oop5.visibility.php
Edit -- https://master.php.net/note/edit/104738
Del: integrated -- https://master.php.net/note/delete/104738/integrated
Del: useless -- https://master.php.net/note/delete/104738/useless
Del: bad code -- https://master.php.net/note/delete/104738/bad+code
Del: spam -- https://master.php.net/note/delete/104738/spam
Del: non-english -- https://master.php.net/note/delete/104738/non-english
Del: in docs -- https://master.php.net/note/delete/104738/in+docs
Del: other reasons-- https://master.php.net/note/delete/104738
Reject -- https://master.php.net/note/reject/104738
Search -- https://master.php.net/manage/user-notes.php