pear-core: php4 constructors

raw

1-parent.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
class A
{
    function __construct()
    {
        echo " A::__construct\n";
    }
}
 
class B extends A
{
    function B()
    {
        echo "B::B\n";
        $this->A();
    }
}
 
class C extends A
{
    function C()
    {
        echo "C::C\n";
        parent::__construct();
    }
}
 
$c = new C();
$b = new B();
 
?>
 
raw

2-parent-output.txt

$ php-5.6.3 6-parent.php 
C::C
 A::__construct
B::B
PHP Fatal error:  Call to undefined method B::A() in /home/cweiske/Dev/pear/test/165/6-parent.php on line 15

Fatal error: Call to undefined method B::A() in /home/cweiske/Dev/pear/test/165/6-parent.php on line 15
Christian Weiske Christian Weiske
owner

History