php-src/tests/classes/class_abstract.phpt

30 lines
429 B
Plaintext
Raw Normal View History

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
Fatal error: Uncaught Error: Cannot instantiate abstract class base in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d