Created
November 8, 2016 06:10
-
-
Save gorkamu/2b6857d5051b81476ba3ad79abe08d58 to your computer and use it in GitHub Desktop.
Ejemplo de constructor
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 Gorkamu | |
{ | |
private $salario; | |
private $medidas; | |
public function __construc($salario, $medidas) { | |
$this->salario = $salario; | |
$this->medidas = $medidas; | |
} | |
public function cuantoMido() { | |
return $this->medidas; | |
} | |
public function cuantoCobro() { | |
return $this->salario; | |
} | |
} | |
$gorkamu = new Gorkamu('3000 €', '33cm'); // Tipico forocochero | |
echo $gorkamu->cuantoMido(); // Imprime '33cm' | |
echo $gorkamu->cuantoCobro(); // Imprime '3000 €' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment