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