<?php trait Hello { public function getHello(){ return 'Hello'; } public function sayHelloWorld1() { echo "{$this->getWorld()} {$this->getHello()}\n"; } abstract public function getWorld(); } trait World { public function getWorld(){ return 'World'; } public function sayHelloWorld2() { echo "{$this->getWorld()} {$this->getHello()}\n"; } abstract public function getHello(); } class MyHelloWorld { use Hello, World; public function __construct() { $this->sayHelloWorld1(); $this->sayHelloWorld2(); } } new MyHelloWorld;
You have javascript disabled. You will not be able to edit any code.