Re: Re: Ambiguity in the oop5 visibility docs

From: Date: Sun, 27 May 2018 18:02:29 +0000
Subject: Re: Re: Ambiguity in the oop5 visibility docs
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969386957@lists.php.net to get a copy of this message
class A { public function foo(){ echo $this->b; // No property $b in parent class } } class B extends A { protected $b = 'foo'; } $a = new B(); $a->foo(); // prints 'foo' In classic OOP, parent class can't access unknown to him member of child class. And phrases like
can be accessed within the class itself and parent classes.
explode the brain! How it can be - reverse inheritance, from child to parent!? I think that more detailed description is needed, with behavior nuances.

« previous php.doc (#969386957) next »