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