note 104738 deleted from language.oop5.visibility by danbrown
| From: | danbrown@php.net | Date: | Tue, 05 Jul 2011 13:39:48 +0000 |
| Subject: | note 104738 deleted from language.oop5.visibility by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181241@lists.php.net to get a copy of this message | ||
Note Submitter: zara
----
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