|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-07-22 15:35 UTC] marsella dot lorenzo at gmail dot com
Description: ------------ --- From manual page: http://www.php.net/language.oop5.visibility --- Traduction problem between : Members declared protected can be accessed only within the class itself and by inherited classes. L'accès aux éléments protégés est limité à la classe elle-même, ainsi qu'aux classes qui en héritent,--> et à ses classes parentes. <-- Protected members can't be accessed by parent class. Expected result: ---------------- L'accès aux éléments protégés est limité à la classe elle-même, ainsi qu'aux classes qui en héritent. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 22:00:01 2026 UTC |
Also it's really bad practice because a parent class should not know about its child, the parent class do in fact have access to protected properties. <?php class A { public function test() { echo self::class . ':' . $this->foo; } } class B extends A { protected $foo = 'bar'; } (new B())->test(); // A:bar ?> Do we want to fix the english version to reflect the reality ? or should we fix the french one not to advocate bad practices ?