note 123306 added to language.oop5.traits
| From: | zhaowo8 at gmail dot com | Date: | Mon, 05 Nov 2018 10:19:14 +0000 |
| Subject: | note 123306 added to language.oop5.traits | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209614@lists.php.net to get a copy of this message | ||
Don't access a class which uses a trait before the definition of class.
e.g.
$myObj = new MyClass();
$myObj->says();
trait MyTrait {
public function says(){
echo 'Hello World', '<br>';
}
}
class MyClass{
use MyTrait;
}
//Fatal error: Class 'MyClass' not found .
Why?
----
Server IP: 208.43.231.9
Probable Submitter: 202.60.226.50
----
Manual Page -- http://php.net/manual/en/language.oop5.traits.php
Edit -- https://master.php.net/note/edit/123306
Del: integrated -- https://master.php.net/note/delete/123306/integrated
Del: useless -- https://master.php.net/note/delete/123306/useless
Del: bad code -- https://master.php.net/note/delete/123306/bad+code
Del: spam -- https://master.php.net/note/delete/123306/spam
Del: non-english -- https://master.php.net/note/delete/123306/non-english
Del: in docs -- https://master.php.net/note/delete/123306/in+docs
Del: other reasons-- https://master.php.net/note/delete/123306
Reject -- https://master.php.net/note/reject/123306
Search -- https://master.php.net/manage/user-notes.php