note 119439 added to language.oop5.final
| From: | suisuiruyi at gmail dot com | Date: | Mon, 06 Jun 2016 09:07:23 +0000 |
| Subject: | note 119439 added to language.oop5.final | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205669@lists.php.net to get a copy of this message | ||
Note: Properties cannot be declared final, only classes and methods may be declared as final.
you can use trait:
<?php
trait PropertiesTrait {
public $same = true;
public $different = false;
}
class PropertiesExample {
use PropertiesTrait;
public $same = true; // Strict Standards
public $different = true; // è´å½é误
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 117.158.156.184
----
Manual Page -- http://php.net/manual/en/language.oop5.final.php
Edit -- https://master.php.net/note/edit/119439
Del: integrated -- https://master.php.net/note/delete/119439/integrated
Del: useless -- https://master.php.net/note/delete/119439/useless
Del: bad code -- https://master.php.net/note/delete/119439/bad+code
Del: spam -- https://master.php.net/note/delete/119439/spam
Del: non-english -- https://master.php.net/note/delete/119439/non-english
Del: in docs -- https://master.php.net/note/delete/119439/in+docs
Del: other reasons-- https://master.php.net/note/delete/119439
Reject -- https://master.php.net/note/reject/119439
Search -- https://master.php.net/manage/user-notes.php