note 100149 added to language.oop5.final
| From: | Anonymous at osu1 dot php dot net | Date: | Tue, 28 Sep 2010 14:06:20 +0000 |
| Subject: | note 100149 added to language.oop5.final | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172765@lists.php.net to get a copy of this message | ||
The behaviour of FINAL is not as serious as you may think. A little explample:
<?php
class A {
final private function method(){}
}
class B extends A {
private function method(){}
}
?>
Normally you would expect some of the following will happen:
- An error that final and private keyword cannot be used together
- No error as the private visibility says, that a method/var/etc. is only visible within the same
class
But what happens is PHP is a little curios: "Cannot override final method A::method()"
So its possible to deny method names in subclasses! Don't know if this is a good behavior, but
maybe its useful for your purpose.
----
Server IP: 85.214.154.209
Probable Submitter: 92.50.88.251
----
Manual Page -- http://www.php.net/manual/en/language.oop5.final.php
Edit -- https://master.php.net/note/edit/100149
Del: integrated -- https://master.php.net/note/delete/100149/integrated
Del: useless -- https://master.php.net/note/delete/100149/useless
Del: bad code -- https://master.php.net/note/delete/100149/bad+code
Del: spam -- https://master.php.net/note/delete/100149/spam
Del: non-english -- https://master.php.net/note/delete/100149/non-english
Del: in docs -- https://master.php.net/note/delete/100149/in+docs
Del: other reasons-- https://master.php.net/note/delete/100149
Reject -- https://master.php.net/note/reject/100149
Search -- https://master.php.net/manage/user-notes.php