Created
July 10, 2014 01:22
-
-
Save whizark/2661a9a9fdec0eb66fea to your computer and use it in GitHub Desktop.
Extending Traits #test #php
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 | |
trait FirstTrait | |
{ | |
public function firstMethod() { | |
echo 'This is the firstMethod()' . PHP_EOL; | |
} | |
} | |
trait SecondTrait | |
{ | |
use FirstTrait; | |
public function secondMethod() { | |
echo 'This is the secondMethod()' . PHP_EOL; | |
} | |
} | |
class ConcreteClass | |
{ | |
use SecondTrait; | |
} | |
$aConcreteClass = new ConcreteClass(); | |
$aConcreteClass->firstMethod(); | |
// This is the firstMethod() | |
$aConcreteClass->secondMethod(); | |
// This is the secondMethod() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment