Object-Oriented PHP: Working with Inheritance

Explore the idea of inheritance in object-oriented programming, and how inheritance works in PHP

Learn how inheritance works in PHP. This tutorial explores the concept of parent and child classes; overriding methods; final classes; abstract classes, and interfaces. Example code included.

In this article we're going to explore the idea of inheritance in object-oriented programming, and how inheritance works in PHP. With inheritance, your objects and classes can become much more powerful and flexible, and you can save a lot of time and effort with your coding.

We'll look at the following topics in this article:

  • The concept of inheritance, and why it's so useful
  • How one PHP class can inherit from another
  • How a child class can override some of the functionality of its parent
  • Working with final classes and methods
  • Using abstract classes, and
  • Working with interfaces.


Comments

Be the first to write a comment

You must me logged in to write a comment.