PHP

Constructors and Destructors

class poodle extends dog {
   public function bark() {
      print "Yip!\n";
   }
   
   public function __construct($DogName) {
      parent::__construct($DogName);
      print "Creating a poodle\n";
   }

   public function __destruct() {
     print "{$this->Name} is no more...\n";
     parent::__destruct();
   }
}

José M. Vidal .

25 of 33