Created
December 28, 2018 16:42
-
-
Save masterfermin02/ab4bb403e80d38de2edd2e7419855c1e to your computer and use it in GitHub Desktop.
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 | |
# copy right Fermin Perdomo | |
interface day { | |
public function whatYouDoing(); | |
} | |
class Holiday implements day { | |
protected $dayName = ""; | |
public function __construct($dayName) | |
{ | |
$this->dayName = $dayName; | |
} | |
public function whatYouDoing() | |
{ | |
return "Es {$this->dayName}, Búscame en la fiesta!"; | |
} | |
} | |
class RegularDay implements day { | |
public function whatYouDoing() | |
{ | |
return "Estoy programando"; | |
} | |
} | |
$days = [new RegularDay(), new RegularDay(), new RegularDay(), new Holiday("31 de Diciembre"), new Holiday("01 de Enero")]; | |
foreach($days as $day){ echo $day->whatYouDoing().PHP_EOL; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment