Created
November 6, 2016 19:21
-
-
Save gorkamu/83780bea63001cf9c93ffc15a04ea721 to your computer and use it in GitHub Desktop.
Ejemplo de clase hija
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 | |
class PaqueteDeGoldenVirginia extends PaqueteDeTabaco | |
{ | |
private $marca = 'golden virginia'; | |
private $tipo = 'rubio'; | |
// Redefinición del método padre | |
function sacarCigarrillo() | |
{ | |
$cigarrillo = null; | |
if(parent::comprobarSiHayTabaco()) { | |
$tabaco = $this->sacarTabaco(); | |
$papel = $this->sacarPapel(); | |
$filtro = $this->sacarFiltro(); | |
$cigarrillo = $this->liarCigarrillo($tabaco, $papel, $filtro); | |
} | |
return $cigarrillo; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment