When a class
Abstract class is only use for inheriting another class. Main purpose of creating abstract class is to protected or restricted from direct object creation.
Example:
1 2 3 4 5 6 7 8 9 10 11 | <?php abstract class Harishchandra { } class Gentleman extends Harishchandra { } $gandhi = new Harishchandra; ?> |
Output:
1 | Fatal error: Cannot instantiate abstract class Harishchandra |