Tag Archives: Abstract class

Polymorphism and WordPress: Abstract classes

When we covered inheritance, there were some questions about interfaces and abstract classes.

  • What can you use them for?
  • What are the advantages?
  • When should you use them?

These are all great questions that are worth exploring. As the title suggests, “Polymorphism” is the object-oriented feature that helps answer these questions. It’s not an easy feature to grasp.

That’s why most of the article will be about an in-depth example. You’ll see the thought process involved with using it. This will help you understand it better so you can apply it to your own projects.

Continue reading Polymorphism and WordPress: Abstract classes

Using inheritance with WordPress

As a WordPress developer, you’re always looking for ways to better reuse your code between projects. Your time is valuable and you don’t want to reinvent the wheel each time you start a new project.

Object-oriented programming can help you with that. In a previous post, I covered why you should learn it. Now it’s time to take things further by going over the main feature for code reuse. You’ve probably heard about it before. It’s called “inheritance“.

Continue reading Using inheritance with WordPress