Describe the lifecycle of object creation.

June 12th, 2008 | by Shubhabrata |
  1. 2 Responses to “Describe the lifecycle of object creation.”

  2. By Shyambabu on Feb 2, 2009 | Reply

    first we have to create a class with parameters or with out parameters and with some funtions.
    like class Test{
    $no;
    $name;
    function Exampleclass(){
    $no=0;
    $name=NULL;
    }
    function setNo($num)
    {
    $no=$num;
    }
    function setName($uname)
    {
    $name=$uname;
    }
    function getNo(){
    return $this->no;
    }
    function getName(){
    return $this->name;
    }
    }
    class TestExample{
    $testexample= new Exampleclass();
    $testexample->setNo(1);
    $testexample->setName(’aa’);
    $testexample->getNo();
    $testexample->getName();
    }

  3. By hemant on Feb 28, 2009 | Reply

    The Object $testexample is still live untill the script is running or if you forcefully destroy with using the unset() function. If you use the constructor & deconstructor than it is automation the destroy at the end of the script.

    One More think if you have two deconstructor for parient & child class than only the child’s class deconstructor is execute automatic. for calling the parent you must call them like.. parent::__deconstructor();

Post a Comment