Created
September 30, 2019 12:13
-
-
Save caironm/f247d4f7c422dc9fc7cddb47388f0b64 to your computer and use it in GitHub Desktop.
Princípios de Segregação de Interfaces
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 | |
interface Aves | |
{ | |
public function andar(); | |
} | |
interface AvesQueVoam extends Aves | |
{ | |
public function voar(); | |
} | |
interface AvesQueNadam extends Aves | |
{ | |
public function nadar(); | |
} | |
class Pato implements AvesQueVoam, AvesQueNadam | |
{ | |
public function voar() | |
{ | |
//lógica | |
} | |
public function nadar() | |
{ | |
//lógica | |
} | |
public function andar() | |
{ | |
//lógica | |
} | |
} | |
class Pinguim implements AvesQueNadam | |
{ | |
public function nadar() | |
{ | |
//lógica | |
} | |
public function andar() | |
{ | |
//lógica | |
} | |
} | |
class Andorinha implements AvesQueVoam | |
{ | |
public function andar() | |
{ | |
//lógica | |
} | |
public function voar() | |
{ | |
//lógica | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment