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