PHP theorytheory 0/50 · 0%
OOP · easy

12. Inheritance

Extending classes.

A class extends another with the extends keyword, inheriting its public and protected members. The parent:: syntax calls an overridden parent method or constructor from a child class.

PHP supports single inheritance for classes; multiple behaviors are instead composed using interfaces and traits.

Check your understanding

  1. 1. Which keyword extends a class?

  2. 2. How do you call a parent constructor?