14: Abstract Classes in OOP PHP | Abstract Explained | Object Oriented PHP Tutorial | PHP Tutorial

Поделиться
HTML-код
  • Опубликовано: 2 фев 2025

Комментарии • 103

  • @davidsimonovic6471
    @davidsimonovic6471 5 лет назад +42

    I would love to see a OOP PHP full site video after the oop tutorial. My morning starts with a coffe and lesson here. Keep it going.

    • @JoshuaTMagee
      @JoshuaTMagee 5 лет назад +7

      I second this, and would be more than happy to pay money for it. Ideally a full website build that includes OOP PHP coding solutions for user authentication, password recovery, user account dashboard, and shopping cart/checkout. Thank you!

    • @lebedev9114
      @lebedev9114 4 года назад +2

      Guys , I am also learning PHP and it is going tough for sure, but don't be deceived by videos. The videos are there to give you the theory, the concepts , but 80% of being a successful programmer is just coding on a daily basis whether it is 45 min or 8 hours , and actually do the code yourself . You can practice with simple things, eventually you will realize it is all repetitive. You don't need to a whole tutorial on building a shopping cart to build one, just start actually putting in the work..

    • @abdulrahmann1621
      @abdulrahmann1621 4 года назад +2

      @@lebedev9114 Hey bro do you ever know why the extends thing is not working ? when i make a class for example and then make another class and extends from the first class in another file it's giving me an error if i don't include the file of the parent class in the file of the second class>>> without including the file it's not extending any thing!!

    • @lebedev9114
      @lebedev9114 4 года назад

      @@abdulrahmann1621 bro check the autoload tutorial and make sure you made it correctly. Otherwise each time you make a new class file you have to use 'include' function to include the other class you plan to extend.

  • @stormybear4986
    @stormybear4986 Год назад +1

    I love Dani's tuts because he speaks a neutral dialect of English (so many computer tuts come out of India and the people speaking have a very poor grasp of English and they are too difficult to uunderstand) and he gives very helpful info. Dani is one of the best channels on youtube for programming!

    • @Michael-lo3ht
      @Michael-lo3ht Год назад

      Totally agree. They also speak English at the same speed they're used to speaking. So it's impossible to understand all the words. On top of that, trying to pick out technical details multiply the problem. This is one channel I am hooked on.

  • @onee
    @onee 3 года назад +7

    If you're wondering what abstract classes are (like me), and WHY we use abstract classes, go to 8:41. I've been looking up and down the internet for someone to explain this in simple words to me, and finally found it. For some reason the other people I stumbled upon all make it unnecessarily overly complex. Especially if they intend to teach this to beginners.

    • @lpanebr
      @lpanebr 2 года назад

      I agree!

  • @andreitodosi
    @andreitodosi 5 лет назад +43

    Always wandered what the Peaky Blinders are up to these days..

  • @jaicarter6337
    @jaicarter6337 5 лет назад +2

    I've watched both your PHP playlists and followed every step - it's really helped me understand PHP on a better level than sites like Codecademy thanks bud!

  • @MuhammadAli-ve7mt
    @MuhammadAli-ve7mt 2 года назад +4

    I'm going to leave this here in case someone finds the use of abstract classes confusing even after the explanation.
    Consider an abstract class for an Employee. Each employee is going to have common attributes such as first name, last name, address and so on, but there will be some attributes that differ.
    Now, let's say we are talking about an educational institution. There can be "permanent" or "visiting" employees. Permanent employees get paid an equal amount every month, so their salaries can be defined in their own "PermanentEmployee" class which extends the main "Employee" class. And for visiting employees, the salary can be defined in a class called "VisitingEmployee" which also extends the main Employee class.
    abstract class Employee{
    protected $firstName;
    protected $secondName;
    protected $address;
    }
    class PermanentEmployee extends Employee{
    private $salary;
    }
    class VisitingEmployee extends Employee{
    private $hourlySalaryRate;
    }
    In this way, we get to use the common attributes through the child class, as well as attributes of their own.

  • @Born2DoubleUp
    @Born2DoubleUp 3 года назад

    I'm here! 😎 Great video, just posting a comment to show some support! Keep up the good work. 🤙

  • @Mesrour
    @Mesrour 10 месяцев назад +2

    Deep Theory + Practical Life Examples + Clear Explantations = Dani :)

  • @bgray79
    @bgray79 4 года назад +8

    I just discovered that the order in which classes are included is important. I haven't heard you mention that yet. It took me a few minutes to figure out why I was getting an error, as I had been using a separate header, index, footer page. After reducing it down to what you have here, I still got an error stating that the "Visa class could not be found referenced in BuyProduct". Then I moved the include abstract statement to the top, and voila! It works.

    • @derpspopovich1579
      @derpspopovich1579 4 года назад

      oh fk thanks for this.been trying to solve this error for a minute. the include abstract statement should be first at the top.

    • @ozanulutas3334
      @ozanulutas3334 4 года назад

      That's because the computer read the codes from start (top of the file) to finish. If you woludn't include the abstract classes -which will be used(extended) later- first it throws an error about not finding the referenced class.

    • @samduss4193
      @samduss4193 2 года назад

      if need to setup them are required or what s going to happen with autoloader :) .... Let see one step at a time :) this is coding hahah

  • @4english21
    @4english21 4 года назад +1

    you'd be my favorite teacher. the way you explain stuff is so clear and that's perfect, maybe i couldnt say the same for the examples though. keep up the good stuff anyway.

  • @dzintarsmagons
    @dzintarsmagons 4 года назад +1

    Thank you for the effort that you put in making these videos. Your way of clarifying things makes this way easier.

  • @m_lk9434
    @m_lk9434 4 года назад +1

    Started watching your videos to learn a few concepts that i was uncertain of. And now im watching all the videos just because I love they way you speak😂😂❤️
    But I must appreciate, the explanation is convincing, they way you present the content is awesome. Good luck❤️

  • @binsarharseno
    @binsarharseno 5 лет назад

    I think by just listening your explanation like a podcast i will understand what is abstract class is, very clear, thank you

  • @lpanebr
    @lpanebr 2 года назад

    Just like the interfaces video, this is great! Clear explanation with real world use case. Thank you!

  • @vlatkoviamkd
    @vlatkoviamkd 4 года назад

    This is the first video that i have seen from you but the way you explain things are one of the best i have seen and i have been watching many of Udemy and youtube courses . Respect, keep on the good work. Subscribed

  • @SherwinlouwZa
    @SherwinlouwZa 3 года назад

    the best oop php tutorial I've come across. Clarity!!!!

  • @asuUcKa
    @asuUcKa 4 года назад +1

    Wow 3 days of school = 1 of your videos, (i need to put more attention to class) but i learn better here.

  • @alexlytle089
    @alexlytle089 3 года назад

    Finally a clear explanation of abstract classes

  • @bilalbeny4172
    @bilalbeny4172 Год назад +1

    thank you for this amazing video :), I love your way in explanation and simplify things, keep going🙏

  • @MatheusBellucio
    @MatheusBellucio Год назад

    this course is amazing, amazing teacher. And also its a strange feelin to learn all of this from Ellon Musk. HAHAHA just kidding, thank you a lot for all of this classes. Really helped. The world need people like you!

  • @EnglishSpeaking_Studio
    @EnglishSpeaking_Studio 3 года назад +1

    I really love all videos and the method used to teach, Great job Bro

  • @OPGAMER.
    @OPGAMER. 4 года назад +2

    Really Good Idea of Naming Files!!! I will Follow this!!

  • @RahmanHaghparast
    @RahmanHaghparast Год назад +1

    Simple and well explained. Thanks.

  • @lauramazariegos6412
    @lauramazariegos6412 2 года назад

    Thank you for a great explanation! That really cleared up the fuzzy pieces for me on abstract classes and their application.

  • @localLyricsPh
    @localLyricsPh Год назад

    The best lessons dani keep it up. I really prefer this youtube because it's free and well explained. 💞💞

  • @zedshaw7275
    @zedshaw7275 5 лет назад +2

    That was an awesome set of videos. I learned a lot from you thank you.

  • @acavaelnick
    @acavaelnick 5 лет назад +1

    Great series of videos dude!
    Really helping me out to understand this concepts, thank you so much!

  • @MiriamAraújo-y1x
    @MiriamAraújo-y1x Год назад +1

    Thank you so much for making this video.

  • @naganorthwind
    @naganorthwind 5 лет назад +2

    Very precisely elaborated. Would like to see laravel tutorial too. Thank you

  • @jeesambo
    @jeesambo 5 лет назад +1

    Thank you so much. Your presentation is extremely perfect. thanks alot for the tutorial. Fly high.

  • @AbhishekBiz
    @AbhishekBiz 5 лет назад

    Dude you have the great style of coding and fashion both.

  • @stormybear4986
    @stormybear4986 Год назад

    Dani for a person whose first language is not English, you have really a masterful command of the language. Your accent sounds very natural, i think you must've spent a lot of time in the USA to master our crazy accents. I was an ESL teacher for many years and I wish I could bottle your accent and give it to my students. How long were you in the USA and what part of the country? I'm guessing the midwest or California.

  • @TahirBhai
    @TahirBhai 3 года назад

    Good to see a detailed OOP series in PHP with awesome real life examples. Thank you @Dani Krossing

  • @tryharder927
    @tryharder927 5 лет назад +1

    i will watch all of your videos
    love it man

  • @odunladeoluwaseun7880
    @odunladeoluwaseun7880 5 лет назад +1

    Nice tutorial on abstract. thanks for the usually quality delivery. please I need a revision on using traits

  • @palyons4817
    @palyons4817 5 лет назад

    You're videos have been a great help, many thanks!

  • @arshiatolou1958
    @arshiatolou1958 2 года назад

    tysm for this great content Mr.Dani !

  • @generalpolkovnik4039
    @generalpolkovnik4039 5 лет назад +1

    thank you all your videos helped me

  • @ProgrammingwithPeter
    @ProgrammingwithPeter 5 лет назад

    Your tutorials are great, flawless !

  • @nikolav6350
    @nikolav6350 5 лет назад

    THANK YOU FOR THIS OPP LESSONS YOU ARE THE BEST!

  • @NawarZarif
    @NawarZarif 4 года назад

    Very nice presentation.thanks

  • @TommyTompkins
    @TommyTompkins 3 года назад

    Is it possible to have a method in your abstract class that calls an abstract function that is implemented in the child class? I'm trying to do this but keep getting errors.

  • @Michael-lo3ht
    @Michael-lo3ht Год назад

    I love the videos. I will have to digest more of the interfaces again, as it took too many turns and twists later and lost me. I have to say I'm totally lost on this one. I guess when I hear abstract I guess I expected the names to be abstract or something. So far it just only looks like you extended a class. I will have to maybe find something that might fill in the blanks for me. Sorry, that I didn't quite pick it up for some reason.

  • @98toxic1
    @98toxic1 5 лет назад

    You're the man! Thanks for all you do!!

  • @dinushasathyajith5049
    @dinushasathyajith5049 5 лет назад

    Great video. Thanks Daniyel 😁😁

  • @LostAlienOnEarth
    @LostAlienOnEarth Год назад

    Some important rules:
    1. One class can extend only one abstract class (PHP doesn’t support multiple inheritance).
    2. Any class with at least one abstract method must be declared abstract.
    3. Abstract classes might contain concrete methods (rules or logic already implemented), interfaces don't have any implementation (it is just a prototype declaring the signatures of the methods - return type, parameters), it's just a contract that must be followed by implementing classes which will supply its own implementation.

  • @tuncaybasak4953
    @tuncaybasak4953 4 года назад

    So, in the MVC design pattern the MODEL class is declared with ABSTRACT? (as it is only extended by VIEW and CONTROL classes and never called by a constructor)

  • @earlempic3983
    @earlempic3983 3 года назад

    One other thing that you can do in extending class is you can play the callback like in BuyProduct Class
    public function visaPayment(){
    $callback = parent::visaPayment();
    $callback.= " from buy product."
    return $callback;
    }
    output will be "Perform a payment from buy product."

  • @ademineshat
    @ademineshat 5 лет назад +4

    Will we build some kind of Project including things we've learned?
    Anyway thanks
    Edit: Best video sofar including Voice quality, video and how you placed the things :)

  • @tuananhdo1870
    @tuananhdo1870 5 лет назад +3

    Could you make tutorial on namespace in PHP?

  • @karthickm2623
    @karthickm2623 4 года назад

    What suppose multiple class I need use abstract class "implement" not required here ?

  • @adilsaeed5381
    @adilsaeed5381 4 года назад +1

    Uncaught Error: Class 'visa' not found in C:\xampp\htdocs\oop\classes\buy.abstract.php:4 Stack trace: #0 C:\xampp\htdocs\oop\abstrction.php(2): include() #1 {main} thrown in C:\xampp\htdocs\oop\classes\buy.abstract.php on line 4
    whts the solution i did the same code only names are diffr

  • @abdulrahmann1621
    @abdulrahmann1621 4 года назад

    hello mmtuts do you ever know why the extends thing is not working ? when i make a class for example and then make another class and extends from the first class in another file it's giving me an error if i don't include the file of the parent class in the file of the second class>>> without including the file it's not extending any thing!!

  • @Oxmond
    @Oxmond 5 лет назад +1

    Good job! 👍 && hat == "awesome"

  • @Maccelerate
    @Maccelerate 5 лет назад

    Great video!

  • @rimantasdanilevicius6754
    @rimantasdanilevicius6754 4 года назад +1

    Can we say that abstract and interface almost do the same? I think I see that we can do the same with interface and interface more useful. Because what if you had more classes which contains other payment types like Paypal? Does it mean I need to create another abstract class for Paypal and extend it in new byproduct class? It is already sounds confusing :D
    Very clear communication.

  • @raulrojas6552
    @raulrojas6552 2 года назад

    Easy and for the whole family

  • @josemfcheo
    @josemfcheo 4 года назад

    Thanks man!

  • @stormybear4986
    @stormybear4986 Год назад

    Dani, how did you learn PHP to such a high level?l I studied software engineering in college and I don't have the level of mastery of PHP that you have.

  • @patrik5123
    @patrik5123 4 года назад

    Why do some insist on never wrapping include or include_once with parenthesis? I mean, it's a function, so it looks more correct as include('file.php');

  • @oghenevwefepeace2501
    @oghenevwefepeace2501 2 года назад

    Please how do i run mysql logics with getters and setters

  • @gtggj6851
    @gtggj6851 4 года назад

    You can run most of examples in the windows console using php - f name.php .

  • @Urti
    @Urti 5 лет назад

    You are great ! please create laravel course.

  • @roiunger7796
    @roiunger7796 5 лет назад +1

    Beautiful hat my brother

  • @RK-gm4pd
    @RK-gm4pd 5 лет назад

    Great video. Thanks to author!
    All these OOP it's just total mess and gibberish. I never understood why people invent tons of unnecessary rules and frames for it's life. JS forever! Only prototype ))

    • @daniele5692
      @daniele5692 5 лет назад

      «I never understood why people invent tons of unnecessary rules and frames for it's life»
      yes, JS hasn't unnecessary rules....

  • @anewworld5201
    @anewworld5201 4 года назад

    Which is base class and derives class

  • @CastleShield
    @CastleShield 2 года назад

    You look like a movie star on a vacation in Europe with that hat and glasses.

  • @danielmobbs5096
    @danielmobbs5096 4 года назад

    love the hat!!! :D

  • @jkrmarmol
    @jkrmarmol 3 года назад

    you look like Elon Musk haha btw thank you so much your video are very helpful to me

  • @YCode_
    @YCode_ 5 лет назад

    gooood job thank you

  • @kubulus7868
    @kubulus7868 5 лет назад +1

    do you use php on the daily basis? I ask, 'cause php is gradually being replaced by node and other js things.

    • @kubulus7868
      @kubulus7868 5 лет назад

      @@jasondavies3772 Yeah I do, and I am even on php side, but I just noticed this trend

  • @youssefdaoud7265
    @youssefdaoud7265 5 лет назад +2

    Mmtuts can you please create a customer queing system

  • @perianka
    @perianka 4 года назад

    where are you from?

  • @siriusgd4753
    @siriusgd4753 5 лет назад +1

    I still get confused as to how an abstract class is any different from a simple extended class.

    • @dusanknezevic4028
      @dusanknezevic4028 5 лет назад +3

      The functionality is basically the same, however as explained in the vid the main difference is that abstract classes and functions/methods can't be instantiated (you can't create the objects from them like you can from regular ones). You can think of it as a chunk of a common reusable code that you never gonna use on its own, but only as a substrate or a base class to extend to your other classes that all should extend the properties and methods from this abstract one.

    • @abdulrahmann1621
      @abdulrahmann1621 4 года назад +1

      @@dusanknezevic4028 Hey bro do you ever know why the extends thing is not working ? when i make a class for example and then make another class and extends from the first class in another file it's giving me an error if i don't include the file of the parent class in the file of the second class>>> without including the file it's not extending any thing!!

  • @jasminepleass3818
    @jasminepleass3818 3 года назад

    If you're coming across an error 'Uncaught Error: Class 'Visa' not found' include 'include(__DIR__ .'/../abstract/paymenttypes.abstract.php');' in your BuyProducts.class.php, no need to include this on the index page also.

  • @augischadiegils.5109
    @augischadiegils.5109 3 года назад

  • @kushalchavan1
    @kushalchavan1 5 лет назад

    Please start tuts on php laravel coz we love your explaination 😉 thanks for awesome videos

  • @dhrubavideos
    @dhrubavideos 4 года назад

    U very cleverly just touched it but not elaborated with example

  • @bobz2169
    @bobz2169 Год назад

    08:26

  • @benjamindavies7113
    @benjamindavies7113 2 года назад

    You look like Elon Mask with that hat 😀

  • @nahabat9
    @nahabat9 5 лет назад +1

    please make a laravel series!!!!!!!!!

  • @king_israel6
    @king_israel6 5 лет назад

    Nice hat and video but please I need a huge favor from you😭😭😭

    • @roiunger7796
      @roiunger7796 5 лет назад

      Is everything all right? Maybe I can help you?

    • @king_israel6
      @king_israel6 5 лет назад

      @@roiunger7796 OK I wanted some favour like how to add download link to files and also the php comments video have a little goof. The comments didn't enter the database then again I wanted a pagination page with links😭😭

  • @myvishan
    @myvishan 4 года назад

    PRO TIP: turn the video at x1.25 speed. Thank me later.

  • @tomatomov9061
    @tomatomov9061 2 года назад

    Yet another tutorial showing absolutelly basic usage of abstraction. And 99% will ask themself why would they need abstract classes at all. Will downvote it because you people just copy each other content.

    • @Dani_Krossing
      @Dani_Krossing  2 года назад

      There are a couple of things I'd like to address in regards to your comment...
      Firstly, I'm going into great detail in my video to explain what abstract classes are and how they work. And accusing RUclipsrs who are only here to try and help you, of "just copying each others content", is both disrespectful, and an INCREDIBLE entitled behaviour towards FREE content.
      This link took me 10sec to find on Google, which explains examples of abstract classes and when to use them in detail: www.quickstart.com/blog/when-and-how-to-use-abstract-class-and-interface/
      The issue here is not "RUclipsrs being lazy by copying each other". It's you looking in the wrong places or not understanding it when you find what you were looking for, and then taking your frustrations out on RUclipsrs who provide you with FREE educational content.
      You didn't pay for a Udemy or Lynda course... You are here on RUclips watching FREE content. You are grossly misunderstanding what "rights" you have, when you are trying to 'smite' a content creator who provides FREE educational content.
      I recommend going to a paid service like Udemy, since over there you ACTUALLY have the right to complain about it not being good enough for you.
      If I see another entitled comment from you, I will block you.

  • @cd78
    @cd78 5 лет назад +1

    OOP = overly convoluted nonsense. Learn procedural instead..