Created
October 2, 2015 20:25
-
-
Save alanwillms/21caf22c7d053f671b19 to your computer and use it in GitHub Desktop.
null-implementations.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 | |
// Usando uma interface: | |
interface AssinaturaInterface | |
{ | |
public function isPremium(); | |
public function getValor(); | |
public function cobrar(CartaoCredito $cartao); | |
} | |
class Assinatura implements AssinaturaInterface { ... } | |
class AssinaturaGratuita implements AssinaturaInterface { ... } | |
// Classe nula estendendo a original: | |
class AssinaturaGratuita extends Assinatura { ... } | |
// Classe original estendendo a nula: | |
class Assinatura extends AssinaturaGratuita { ... } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment