Created
January 4, 2019 03:10
-
-
Save joaorobertopb/7e8825adb882deec22b69aee4eabea99 to your computer and use it in GitHub Desktop.
Exemplo em PHP da utilização do princípio Aberto-Fechado ( Open-Closed ) do SOLID
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 Remuneravel | |
{ | |
public function remuneracao(); | |
} | |
class ContratoClt implements Remuneravel | |
{ | |
public function remuneracao() | |
{ | |
//... | |
} | |
} | |
class Estagio implements Remuneravel | |
{ | |
public function remuneracao() | |
{ | |
//... | |
} | |
} | |
class FolhaDePagamento | |
{ | |
protected $saldo; | |
public function calcular(Remuneravel $funcionario) | |
{ | |
$this->saldo = $funcionario->remuneracao(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment