Created
November 27, 2016 11:30
-
-
Save gorkamu/b12c4da18d0952e8d2ba11158e2a126d to your computer and use it in GitHub Desktop.
Ejemplo de uso de un trait en el mundo animal
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 movimientos { | |
function saltar() { /* ... */ } | |
function correr() { /* ... */ } | |
function nadar() { /* ... */ } | |
} | |
class Gato extends Animal { | |
use movimientos; | |
/* ... */ | |
} | |
class Perro extends Animal { | |
use movimientos; | |
/* ... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment