xref: /PHP-7.2/tests/classes/class_abstract.phpt (revision a8d901a8)
1--TEST--
2ZE2 An abstract class cannot be instanciated
3--FILE--
4<?php
5
6abstract class base {
7	function show() {
8		echo "base\n";
9	}
10}
11
12class derived extends base {
13}
14
15$t = new derived();
16$t->show();
17
18$t = new base();
19$t->show();
20
21echo "Done\n"; // shouldn't be displayed
22?>
23--EXPECTF--
24base
25
26Fatal error: Uncaught Error: Cannot instantiate abstract class base in %s:%d
27Stack trace:
28#0 {main}
29  thrown in %s on line %d
30