Abstract classes represent abstract concepts. In our previous tutorials, we created different classes that inherited properties and methods from its parent. If we look at the Animal class hierarchy, the Animal class itself is an abstract concept. We can vaguely say animal, but what type of animal? A dog might be a narrow enough concept, but a German Shepherd is definitely a concrete class, not abstract.
Abstract classes are classes that start with the keyword abstract. If a class contains at least one abstract method, it must be declared as abstract. If a method in an abstract class is defined as abstract, it can only declare the method’s signature. There can be no implementation of the method itself. Also, all methods that are marked as abstract, when inherited, must be implemented in the child class. You will be required to pretty much copy the method signature completely as is. So, the visibility, signature, etc. Let’s take a look at a couple of examples and hopefully this will make sense.
Read the full article on my website
https://www.dinocajic.com/php-abstrac...
Code for this tutorial
https://github.com/dinocajic/php-7-yo...
Full Code
https://github.com/dinocajic/php-7-yo...
PHP Playlist
• PHP Tutorial
--
Dino Cajic
Author and Head of IT
Homepage: https://www.dinocajic.com
GitHub: https://github.com/dinocajic
Medium: / dinocajic
Instagram: / think.dino
LinkedIn: / dinocajic
Twitter: / dino_cajic
My Books
An Illustrative Introduction to Algorithms
https://www.amazon.com/dp/1686863268
Laravel Excel: Using Laravel to Import Data
https://amzn.to/4925ylw
Code Along With Me - PHP: From Basic to Advanced PHP Techniques
https://amzn.to/3M6tlGN
In questa pagina del sito puoi guardare il video online Abstract Classes - PHP - P60 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Dino Cajic 17 giugno 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 193 volte e gli è piaciuto 6 spettatori. Buona visione!