Module Development

Enforce Functionality with Abstract Methods for Drupal 8, 9

Sprout Video

In this tutorial, I will show you the power of abstract classes and how you can enforce subclasses to define certain functions. In this way, you can share logic but for things that are really specific to subclasses, you can force them to define certain functions, but with the specific logic required.

Additional resources

Class Abstraction (PHP Manual)