2003-06-22 03:10:08 +08:00
|
|
|
--TEST--
|
2018-08-10 10:19:55 +08:00
|
|
|
ZE2 An abstract class cannot be instantiated
|
2003-06-22 03:10:08 +08:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
abstract class base {
|
2020-02-04 05:52:20 +08:00
|
|
|
function show() {
|
|
|
|
echo "base\n";
|
|
|
|
}
|
2003-06-22 03:10:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
class derived extends base {
|
|
|
|
}
|
|
|
|
|
|
|
|
$t = new derived();
|
|
|
|
$t->show();
|
|
|
|
|
|
|
|
$t = new base();
|
|
|
|
$t->show();
|
|
|
|
|
|
|
|
echo "Done\n"; // shouldn't be displayed
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
base
|
|
|
|
|
2015-05-18 06:31:43 +08:00
|
|
|
Fatal error: Uncaught Error: Cannot instantiate abstract class base in %s:%d
|
2015-05-16 03:04:07 +08:00
|
|
|
Stack trace:
|
|
|
|
#0 {main}
|
|
|
|
thrown in %s on line %d
|