Created
March 15, 2014 20:15
-
-
Save amacgregor/9573275 to your computer and use it in GitHub Desktop.
Multiple Traits
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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