PHP OOPLesson 51Free preview
PHP Interfaces
This lesson is part of PHP · All levels
Summary
The interface defines a contract as a list of unorganised methods that are mandatory for the class to implement. A class can implement several at once, so it's useful to build abilities across class groups. The entire method in the interface should be publicly visible.
Key points
- The interface is declared with the keyword interface and only contains bodyless methods.
- Class uses the keyword interface of the implement.
- A class can implement more than one interface.
- All methods in the interface are automatically public.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.