Created
January 31, 2014 20:50
-
-
Save tanrax/8742855 to your computer and use it in GitHub Desktop.
PHP: Clase abstracta (sbstract)
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 | |
/** Clase abstracta **/ | |
abstract class Remolque | |
{ | |
//Fuerza la extensión de clase para definir estos métodos | |
abstract public function enganchar(); | |
abstract public function soltar(); | |
public $iPeso = 500; | |
} | |
class Coche extends Remolque | |
{ | |
public function arrancar() { | |
echo 'El coche a arrancado'; | |
} | |
public function enganchar() { | |
echo 'Remolque enganchado'; | |
} | |
public function soltar() { | |
echo 'Soltar remolque'; | |
} | |
} | |
$miCoche = new Coche(); | |
echo $miCoche->iPeso; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment