note 119628 added to language.oop5.traits
| From: | mik-ek8944 at ya dot ru | Date: | Wed, 20 Jul 2016 10:11:43 +0000 |
| Subject: | note 119628 added to language.oop5.traits | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-206059@lists.php.net to get a copy of this message | ||
<?php
trait Hello {
public function sayHello() {
echo 'Hello ';
}
}
trait World {
use Hello;//here the first connection Hello (second in MyHelloWorld )
abstract function sayHello(); //if this line is commentid
/*
FATAL ERROR Trait method sayHello has not been applied, because there are collisions with other
trait methods on MyHelloWorld on line number 18
*/
public function sayWorld() {
$this->sayHello();
echo 'World!';
}
}
class MyHelloWorld {
use Hello, World; //here the second connection Hello (first in World)
}
$o = new MyHelloWorld();
$o->sayWorld(); //Hello World!
?>
----
Server IP: 72.52.91.14
Probable Submitter: 212.34.53.126
----
Manual Page -- http://php.net/manual/en/language.oop5.traits.php
Edit -- https://master.php.net/note/edit/119628
Del: integrated -- https://master.php.net/note/delete/119628/integrated
Del: useless -- https://master.php.net/note/delete/119628/useless
Del: bad code -- https://master.php.net/note/delete/119628/bad+code
Del: spam -- https://master.php.net/note/delete/119628/spam
Del: non-english -- https://master.php.net/note/delete/119628/non-english
Del: in docs -- https://master.php.net/note/delete/119628/in+docs
Del: other reasons-- https://master.php.net/note/delete/119628
Reject -- https://master.php.net/note/reject/119628
Search -- https://master.php.net/manage/user-notes.php