SHARE
TWEET

Untitled

a guest Aug 19th, 2019 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. class Mascota{
  3.     var $nombre;
  4.  
  5.     public function __construct($nombre){
  6.         $this->nombre = $nombre;
  7.     }
  8.  
  9.     public function ladrar(){
  10.         echo "¡Guau!";
  11.     }
  12.  
  13.     public function __toString(){
  14.         return "Soy de la clase mascota. Mi nombre es " . $this->nombre;
  15.     }
  16. }
  17.  
  18. $maggie = new Mascota("Maggie");
  19. echo strval($maggie);
  20. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top