From ba4556cf8a96b0f5455cb985be9e53c5b4ade6b3 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Wed, 10 Oct 2018 20:35:11 -0500 Subject: [PATCH] Added abstract classes page --- assets/templates/_table_of_contents.phtml | 1 + code/abstract.php | 48 +++++++++++++++++++++++ config.php | 6 +++ 3 files changed, 55 insertions(+) create mode 100644 code/abstract.php diff --git a/assets/templates/_table_of_contents.phtml b/assets/templates/_table_of_contents.phtml index 841c855..dfea08e 100644 --- a/assets/templates/_table_of_contents.phtml +++ b/assets/templates/_table_of_contents.phtml @@ -21,6 +21,7 @@
  • Classes: Constructor
  • Static
  • Interfaces
  • +
  • Abstract Classes
  • Credits diff --git a/code/abstract.php b/code/abstract.php new file mode 100644 index 0000000..8cbff27 --- /dev/null +++ b/code/abstract.php @@ -0,0 +1,48 @@ +turnOn(); +$iPhone->unlock(); + +$android = new Android(); +$android->turnOn(); +$android->unlock(); + +// Lastly, you cannot create an instance of an abstract class. PHP would not know how to use the abstract methods +// so when you try to create an abstract instance you will get an error. +$cellPhone = new CellPhone(); diff --git a/config.php b/config.php index d026988..60ebd86 100644 --- a/config.php +++ b/config.php @@ -141,6 +141,12 @@ return [ 'title' => 'Interfaces', 'subtitle' => 'Writing code contracts', 'previous' => 'static', + 'next' => 'abstract', + ]), + Page::create('abstract', null, 'abstract.php', [ + 'title' => 'Abstract Classes', + 'subtitle' => 'Inheriting an interface', + 'previous' => 'interfaces', 'next' => '', ]), ],