تقييمات الطلاب
( 5 من 5 )
١ تقييمات
فيديو شرح PHP Traits - How They Work & Drawbacks - Full PHP 8 Tutorial ضمن كورس PHP Native شرح قناة Program With Gio، الفديو رقم 48 مجانى معتمد اونلاين
In this video, you will learn all you need to know about traits in PHP with examples & in-depth explanations. You'll learn what problems traits solve as well as the problems it can introduce.
SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL
Smash the like button
Subscribe to the channel & turn the notifications on
Post comments, any feedback is greatly appreciated
Become a Patreon: https://www.patreon.com/programwithgio
THANK YOU!
LESSON 2.14
Course Outline - https://github.com/ggelashvili/learnphptherightway-outline
Course Playlist - https://www.youtube.com/playlist?listPLr3d3QYzkw2xabQRUpcZ_IBk9W50M9pe-
RESOURCES
https://www.php.net/manual/en/language.oop5.traits.php
CHAPTERS
00:00 - Intro
00:27 - Multiple inheritance problem
02:02 - Overview of coffee maker example in code
03:08 - Using interfaces instead of multiple inheritance
05:43 - Creating & using traits
08:22 - How do traits work?
08:39 - Method precedence
11:02 - Conflict resolution ("insteadof" & "as" operators)
13:38 - Changing visibility of trait methods
16:02 - Composing traits from other traits
16:46 - Properties within traits
20:40 - Abstract methods in traits
23:19 - Static properties & methods in traits
25:38 - Magic __CLASS__ constant in traits
26:13 - Personal opinion & downsides of traits
28:46 - Example comparing inheritance & traits