Python - Object Oriented Programming | Polymorphism

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ก.ย. 2024
  • Python Polymorphism and abstract classes
    Python Object Oriented Programming, Python OOP concepts
    What is Polymorphism in Python and how it is helpful
    Full Python Beginner Playlist: goo.gl/UrcLw4
    Become My Patron here goo.gl/NcvDQh
    Angular Full 60 Minute Course goo.gl/TL2UFy
    To Join Whatsapp, follow this link chat.whatsapp....
    You can donate any amount via Paypal follow this link goo.gl/JhWsKC
    Join Our Slack Community - goo.gl/pqCjZH
    --You May Also Like --
    Real-Time Chat Series - goo.gl/ri42FD
    Git and Github series - goo.gl/BXyPxf
    Blog with Admin panel Series - goo.gl/S5JGyt
    Laravel Authentication Series: Multi Auth - goo.gl/TyCLlX
    Vue Beginner To advanced Series - goo.gl/1bjdGg
    Sublime Text Best Package Series - goo.gl/6phTPP
    Laravel Ajax Todo Project - goo.gl/p2xTPW
    Laravel 5.4 Full Beginner Playlist - goo.gl/zpKzhM
    Laravel 5.3 Hindi Beginner Tutorials - goo.gl/Kb3ikd
    ==================FOLLOW ME ==================
    Subscribe for New Releases!
    Twitter - / bitfumes
    Facebook - / bitfumes
    Instagram - / bitfumes
    (ask me questions!)
    -- QUESTIONS? --
    Leave a comment below and I or someone else can help you.
    For quick questions you may also want to ask me on Twitter, I respond almost immediately.
    Email me support@bitfumes.com
    Thanks for all your support!

ความคิดเห็น • 42

  • @03cristopher36
    @03cristopher36 4 ปีที่แล้ว +69

    It's "Ni Hao" not "Yeehaw" haha

  • @sebastiannachtigall1558
    @sebastiannachtigall1558 3 ปีที่แล้ว +10

    Hey there, thanks for the video. I think it would be good to also point out what advantages polymorphism provides. In your example, it just adds more stuff to an already working piece of code ;-) But again, thank you for putting in the time to make this video. It is an easy-to-understand example of the "how" of polymorphism.

  • @shaanlashkari8769
    @shaanlashkari8769 3 ปีที่แล้ว +4

    This is a great video , i learnt polymorphim and i almost forgot it , this video gave me a quick revision of polymorphism , thank you Sarthak sir

  • @劉岳樺-m8m
    @劉岳樺-m8m 3 ปีที่แล้ว +8

    Thanks, the concept is clear.
    It really helps !

  • @barrydevine
    @barrydevine ปีที่แล้ว +3

    When you say "ee-haw" so cute. Great vid :)

  • @Cssaarr
    @Cssaarr ปีที่แล้ว +1

    Thanks for trying but seems that any explanation I can find is incomplete or confusing. In this case you showed (if I am not wrong):
    1)"polymorphism as "duck typing": you have two classes with no hereditary relationship amongst them, which simply have methods with exactly the same name.
    2) "polymorphism as overriding": you have one class that inherits annother class (in your example class French inherits class Language ....and as second example class Chinese also inherits class Language), and the "son" class (the class that inherits annother class) has a method with the same name as the parent class (method "say_hello" ) and so it happens that the program will execute the method as defined in the son class, because it is more specific, which means that you can use one same method name ("say_hello") and obtain two different results depending on which code it runs: the code of the parent class or the code of the son class.
    *According to books and videos about JAVA (don`t know if this is posible in Python too, but is useful to know) there is annother type of polymorphim called "method overloading" where you simply create two or more methods with the same name inside a class, but each of those methods has different types of parameters it can recieve, so depending on which type of parameters it recieves from the object that calls the method, one version of the method or annother different one will be executed.

    • @symbio626
      @symbio626 7 หลายเดือนก่อน

      Python does not support method overloading. The syntax don't. Methods with the same name under a class will only retain the last method definition. But they have something to make up for it such as manipulating Default Parameters and Keyword Arguments and Factory Functions (basically instantiating objects via function)

  • @sabbirahamed1894
    @sabbirahamed1894 4 ปีที่แล้ว

    u r awesome. u make it so simple to use one example and it's works for Polymorphism, Inheritance , Abstraction.....He is expert, who can make critical things easy.

  • @kaushikdr
    @kaushikdr 3 ปีที่แล้ว +2

    Is polymorphism the idea that you can have different children from the same parent class? Also, I really like the way you created the "abstract class" in the parent class without having to use the ABC module - just raise an error when it is called!

  • @priyamvadapriyam9415
    @priyamvadapriyam9415 3 ปีที่แล้ว +1

    nice.. so easily expalined. thanks

  • @shrur3527
    @shrur3527 2 ปีที่แล้ว +1

    Thanks a lot
    Good explanation

  • @alejandronieto576
    @alejandronieto576 ปีที่แล้ว

    Thanks from Argentina!

  • @kathiresan.r658
    @kathiresan.r658 2 ปีที่แล้ว

    Bro super ah explain paninga...apdiya python hierarchical inheritance pathi video make panni poduga bro...

  • @eejazishaq4332
    @eejazishaq4332 6 ปีที่แล้ว

    This is an important topic that
    How to use Laravel with WordPress to customize our 3project and theme and develop own API.
    It'll help for all Laravel and wp developers.
    Plz make a video or article about it
    sorry for the comment about it in here!
    Thanks so much.

    • @Bitfumes
      @Bitfumes  6 ปีที่แล้ว

      Sorry, bro I didn't use WordPress.

  • @gam3r.xen0n
    @gam3r.xen0n 2 ปีที่แล้ว

    thanks

  • @Amirkolo
    @Amirkolo 7 หลายเดือนก่อน

    thanks 🙂

    • @Bitfumes
      @Bitfumes  7 หลายเดือนก่อน

      You're welcome!

  • @ShukyPersky
    @ShukyPersky 8 หลายเดือนก่อน

    Thanks for the video.... sorry, this is NOT polymorphism, this is about typecasting.
    Polymorphism is a different mechanism and can't be implemented in Python due to Python's nature being dynamic-typed languge

  • @-_______________________.___
    @-_______________________.___ ปีที่แล้ว +1

    Why they give such simple topics such complex names?

    • @Import_success
      @Import_success ปีที่แล้ว

      It’s not really complex, poly means many and morphism means having different form. These are suffix/prefix taught in middle or highschool depending on where you went.
      ‘Polygon’ - having many sides
      ‘Polysyllabic’ - many syllables
      And more but yeah

    • @Import_success
      @Import_success ปีที่แล้ว

      Remember to always break down a word see if it has any familiar prefix or suffix, we tend to over look them and look at the word as whole a lot of times

  • @opentech5972
    @opentech5972 6 ปีที่แล้ว

    gj . could you explain this in laravel eloquent ?

    • @Bitfumes
      @Bitfumes  6 ปีที่แล้ว +1

      Hmmmm you are right. I will try to explain this on laravel level also

    • @opentech5972
      @opentech5972 6 ปีที่แล้ว

      @@Bitfumes tnx dude

  • @sarthaknimbalkar5868
    @sarthaknimbalkar5868 ปีที่แล้ว

    I was watching the video and all of a sudden my name appeared and I'm like waittt whattttttt😂😂

  • @ramkoirala3457
    @ramkoirala3457 หลายเดือนก่อน +1

    😵

    • @Bitfumes
      @Bitfumes  หลายเดือนก่อน

      did you liked it

  • @KaushikSarkar1978
    @KaushikSarkar1978 5 ปีที่แล้ว +1

    This information is not correct completely.

    • @Bitfumes
      @Bitfumes  5 ปีที่แล้ว

      hey, thanks for this, please tell me what else needs to implement

  • @MioM_
    @MioM_ 7 หลายเดือนก่อน

    Hard to understand

  • @nurkleblurker2482
    @nurkleblurker2482 2 ปีที่แล้ว

    Ni hao

  • @serious6037
    @serious6037 3 ปีที่แล้ว

    lol yeehaw xD

  • @LuisMorales-yx8di
    @LuisMorales-yx8di 2 ปีที่แล้ว +1

    no sense

  • @brawlboy1382
    @brawlboy1382 9 หลายเดือนก่อน

    This don’t make any sense bruh 😂

  • @Ahmed_3711
    @Ahmed_3711 ปีที่แล้ว

    Fita mu

  • @pavinkumarr9608
    @pavinkumarr9608 2 ปีที่แล้ว

    Don't drag and brag while talking. Speak normally

  • @jvcss
    @jvcss 2 ปีที่แล้ว

    to better understand the use of it
    class Language():
    def speak(self):
    print("Universal answer HELLO")
    #raise NotImplementedError("Support but need to be implemented in child!")
    class Portuguese(Language):
    def speak(self):
    print("oi")
    class Spanish(Language):
    pass #WE NEED MORE DEVELOPERS RIGHT NOW
    def main():
    print("started")
    newLang = Portuguese()
    newLang.speak()
    moreLang = Spanish()
    moreLang.speak()
    if __name__ == "__main__":
    main()