php-src/tests/classes/private_006b.phpt

40 lines
537 B
Plaintext
Raw Permalink Normal View History

2003-02-06 07:07:24 +08:00
--TEST--
2003-08-09 22:48:47 +08:00
ZE2 A private method can be overwritten in a second derived class
2003-02-06 07:07:24 +08:00
--FILE--
<?php
class first {
2020-02-04 05:52:20 +08:00
private function show() {
echo "Call show()\n";
}
2003-02-06 07:07:24 +08:00
2020-02-04 05:52:20 +08:00
public function do_show() {
$this->show();
}
2003-02-06 07:07:24 +08:00
}
$t1 = new first();
$t1->do_show();
2018-09-17 01:16:42 +08:00
class second extends first {
2003-02-06 07:07:24 +08:00
}
//$t2 = new second();
//$t2->do_show();
class third extends second {
2020-02-04 05:52:20 +08:00
private function show() {
echo "Call show()\n";
}
2003-02-06 07:07:24 +08:00
}
$t3 = new third();
$t3->do_show();
echo "Done\n";
?>
--EXPECT--
2003-02-06 07:07:24 +08:00
Call show()
Call show()
Done