PHP OOPLesson 50Free preview
PHP Abstract Classes
This lesson is part of PHP · All levels
Summary
A class abstract is a class that cannot be directly instantiated and usually contains an abstract method without a body. The class abstract serves as a framework that must be represented by a concrete child class. If the child doesn't fill out the entire abstract method, PHP will stop the script with a fatal error.
Key points
- Class abstract is declared with the keyword abstract and cannot be called new.
- Abstract methods have no body and must be implemented by the child.
- A class can only inherit one parent class, including the abstract one.
- Class abstract may contain standard methods that are already in place and used together by the child.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.