Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement