Created
August 7, 2019 21:36
-
-
Save parzibyte/05f134620e132760e3bd4a55d5e257ae to your computer and use it in GitHub Desktop.
This file contains 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 Mascota{ | |
var $nombre; | |
public function __construct($nombre){ | |
$this->nombre = $nombre; | |
} | |
public function ladrar(){ | |
echo "¡Guau!"; | |
} | |
public function __toString(){ | |
return "Soy de la clase mascota. Mi nombre es " . $this->nombre; | |
} | |
} | |
$maggie = new Mascota("Maggie"); | |
echo strval($maggie); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment