Created
December 3, 2016 16:32
-
-
Save gorkamu/4ce57bb1b7f1f1340a37a5a8425d3287 to your computer and use it in GitHub Desktop.
Ejemplo de uso de la palabra reservada final en la herencia de objetos
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 PutoAmo | |
| { | |
| public function saluda() { | |
| echo "Hola"; | |
| } | |
| final public function insulta() { | |
| echo "Capullo"; | |
| } | |
| } | |
| class Gorkamu extends PutoAmo | |
| { | |
| public function insulta() { | |
| echo "llamada a PutoAmo::insulta()\n"; | |
| } | |
| } | |
| // Devuelve un error Fatal: Cannot override final method PutoAmo::insulta() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment