xref: /PHP-8.2/tests/classes/private_006.phpt (revision f8d79582)
1--TEST--
2ZE2 A private method can be overwritten in a second derived class
3--FILE--
4<?php
5class first {
6    private static function show() {
7        echo "Call show()\n";
8    }
9
10    public static function do_show() {
11        first::show();
12    }
13}
14
15first::do_show();
16
17class second extends first {
18}
19
20second::do_show();
21
22class third extends second {
23}
24
25third::do_show();
26
27class fail extends third {
28    static function show() {  // cannot be redeclared
29        echo "Call show()\n";
30    }
31}
32
33echo "Done\n";
34?>
35--EXPECT--
36Call show()
37Call show()
38Call show()
39Done
40