Annotation of embedaddon/php/Zend/tests/traits/language007.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Traits can fulfill the requirements of abstract base classes.
3: --FILE--
4: <?php
5: error_reporting(E_ALL);
6:
7: abstract class Base {
8: abstract function sayWorld();
9: }
10:
11: trait Hello {
12: public function sayHello() {
13: echo 'Hello';
14: }
15: public function sayWorld() {
16: echo ' World!';
17: }
18: }
19:
20: class MyHelloWorld extends Base {
21: use Hello;
22: }
23:
24: $o = new MyHelloWorld();
25: $o->sayHello();
26: $o->sayWorld();
27:
28: ?>
29: --EXPECTF--
30: Hello World!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>