Created
September 29, 2014 05:39
-
-
Save ywindish/72b7f8844c6402ea206f to your computer and use it in GitHub Desktop.
PHPのトレイト
This file contains 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 | |
// http://php.net/manual/ja/language.oop5.traits.php | |
trait Kanikama { | |
function eat_kani() { print "eat kanikama"; } | |
} | |
class Salad { | |
use Kanikama; | |
public function eat() { $this->eat_kani(); } | |
} | |
$s = new Salad(); | |
$s->eat(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment