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