Re: Re: Ambiguity in the oop5 visibility docs
| From: | Pedro Magalhães | Date: | Sat, 26 May 2018 15:39:16 +0000 |
| Subject: | Re: Re: Ambiguity in the oop5 visibility docs | ||
| References: | 1 2 3 4 5 | Groups: | php.doc php.internals |
| Request: | Send a blank email to internals+get-102143@lists.php.net to get a copy of this message | ||
On Sat, May 26, 2018 at 3:04 PM, Rowan Collins <rowan.collins@gmail.com>
wrote:
>
> Note that this example also works in Java:
> https://tio.run/##vZMxb9swEIVn
> 61fcKKctbWctMhUIuhgomqIdigwn8mIxpUiDPNkpDP92hxJlW4rsIUBRQhP5
> @O670@MzbvDTs/pzOGAR2KNkkAZDgG9eS4JdBnGtvWOSTAqUqwtDsEFT0@f2
> LAnirpbpTt7XTDuHZnGpg2h34a7vsD/7nBhGFVfE33H7s7mVT8eVz6p75yvk
> eLPT9gBmM/iCxgTAnn9FXDoF7gm2pZYlbciDLLVR3Rx0aMFPJp649haWyKXw
> rrYqb/sa8E1HjXWYG6cVoFJ5mq7jkvy/IGyNLg36w106Exfmt8/2WZYsfuDL
> vSdKVPTCZNWbBCT@ge7qjw71mnyeto@lLudoQNVz6IZ8bmRE3CL80lxGpCHx
> bpTIo@x/AsMNLMRtDzvriBL@ErWN1yfdZmDkYzyqeJQ/sNd29fsR0K9CU2gy
> SUPH@HYsbQd/Il/MxTyCHzVFp@k3f9Y8/A1MlXA1i3UswsbmKC48nGvi
> 4qo4fjHAX8nTR0AL2sa2bBPzp2FwttoYQCkpvA16VcRsR3mfPLqiaN5M8W78ZvCHwys
>
Java's behavior stems from the fact that protected offers package-level
visibility. A concept that we don't have in PHP. To offer a counter
example, C# disallows it: https://ideone.com/DkiCeM
PHP started allowing this in 5.2 due to a bug report stating that it should
be possible: https://bugs.php.net/bug.php?id=37212