A child class can inherit properties and methods from a parent class using extends, and customize behavior by overriding a method (optionally calling parent::method()). Mark a class or method final when you want to prevent subclasses from overriding it.
ADVERTISEMENT