<?php
// sample code to show the use of magic methods __construct and __destruct
// author@ : http://royads.blogspot.com

class parentClass
{
   function __construct()
    {
      echo "\nParent constructor called.";    
    } 

  function __destruct()
  {
    echo  "\ndestroying parent object";
  } 
}

class childClass extends parentClass
{
  function __construct()
  {
     echo "\nchild constructor called.";
     parent::__construct();
  }
  function __destruct()
  {
    echo  "\ndestroying child object";
    parent::__destruct();
  }
}
$obj = new childClass();
?>
