Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Multiple Traits
<?php
class Animal {
public function roar() {
echo "Makes animal sounds";
}
}
trait Cat {
public function roar() {
echo "Meowww";
}
}
trait BigCat {
public function kill() {
echo "Kill an animal";
}
}
class Tiger extends Animal {
use Cat;
use BigCat;
}
$tiger = new Tiger;
$tiger->roar();
$tiger->kill();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.