class Test1 { public void __construct() { print("Test1::__construct() called.\n"); } public void __destruct() { print("Test1::__destruct() called.\n"); } } class Test2 extends Test1 { public void __construct() { print("Test2::__construct() called.\n"); $parent->__construct(); } public void __destruct() { print("Test2::__destruct() called.\n"); $parent->__destruct(); } } class Program { object $test; public void __construct() { print("Program::__construct() called.\n"); $this->test = new Test1(); } public void __destruct() { print("Program::__destruct() called.\n"); } public void main() { print("Program::main() called.\n"); object $test = new Test2(); } }