# 4.1 Demonstrate ability to write code using core and Object Oriented PHP

&#x20;Review the differences between an abstract class and a base class. Review PHP constants.

## Base Class

A base class creates consistent reusable code. When you extend a class the new subclass inherits all methods from the parent class.

## Abstract Class

An [abstract class](https://stackoverflow.com/questions/2558559/what-is-abstract-class-in-php) provides a template for inheriting base class methods. Abstract classes cannot be instantiated

## Interface

An interface provides methods but does not define how to use the methods.

## PHP Constants

[PHP constants](https://www.w3schools.com/php/php_constants.asp) are global variables and must always be declared in `UPPERCASE` according to [Drupal coding standards](https://www.drupal.org/docs/develop/standards/coding-standards#naming).

## Other Resources

* [Drupal.org OOP Prerequisites](https://www.drupal.org/docs/8/creating-custom-modules/getting-started-background-prerequisites-drupal-8)
* [Drupalize.me Introduction to Object-Oriented PHP](https://drupalize.me/series/introduction-object-oriented-php)
* [PHP Manual OOP Interfaces](http://php.net/manual/en/language.oop5.interfaces.php)
