4.7: Introduction to Polymorphism - The Nature of Code

Sdílet
Vložit
  • čas přidán 1. 08. 2015
  • This video looks at the topic of polymorphism in object-oriented programming.
    Read along: natureofcode.com/book/chapter-...
    github.com/shiffman/The-Natur...
    Help us caption & translate this video!
    amara.org/v/QbwE/
    📄 Code of Conduct: github.com/CodingTrain/Code-o...

Komentáře • 183

  • @mirandamayor2565
    @mirandamayor2565 Před 7 lety +354

    In 8 minutes I understood what I could not understand with my teacher in 2 hours.
    Thank you so much

    • @YoursTruelyMe2
      @YoursTruelyMe2 Před 6 lety +10

      Right! People like him I would be happy to take a loan out and pay for this amazing teaching.

    • @MariaBure
      @MariaBure Před 6 lety +2

      Same here :D!

    • @jaredchong4070
      @jaredchong4070 Před 5 lety +5

      School is not really teaching people to be smart.Its to create industrial age employees.
      They taught people in a one way learning style and dislikes creative diverse ways of learning.

    • @ibuucoksiregar9024
      @ibuucoksiregar9024 Před 5 lety +2

      So dammn true.. i read several tutorial on internet about this inheritance stuff..but they cant help me to understand clearly..but it only takes minutes to understand when i watch this

    • @gloverelaxis
      @gloverelaxis Před 2 lety

      yeah a lot of teachers in CS are fucking useless. Dan actually understands teaching well

  • @sorosw2980
    @sorosw2980 Před 4 lety +28

    Y'all this guy is teaching with such enthusiasm, he gets my respect. 💯 Keep up the good work!

  • @saif0316
    @saif0316 Před 4 lety +7

    This is my first lecture to click on and I have to say, this guy is amazing. The level of enthusiasm he has is incredibly contagious.

  • @halefspencer2725
    @halefspencer2725 Před 5 lety +49

    This is why I love youtube. Understood in a couple of minutes what a I couldn't understand on a 3h long lecture.
    Thanks a lot!!!!!

    • @johnwt7333
      @johnwt7333 Před rokem

      What does it tell you about your intellectual skills?

  • @algoprism2833
    @algoprism2833 Před 5 lety +9

    Best code teacher I could ever find.
    I am so happy to be here.

  • @EmporerAxel
    @EmporerAxel Před 6 lety +43

    Thanks so much for this, this was one of those concepts where I understood the theory but couldn't understand why I would use it or why it was so important. Your enthusiasm is infectious :)

  • @the_calibrator
    @the_calibrator Před 6 lety +2

    Effeciently and effectively explained - extra credit for the passion. You've earned a new sub

  • @kossyoto1
    @kossyoto1 Před 5 lety +1

    Man, thank you so much for the great tutorial, I love the way you explain as well as the energy you put into you videos, learning from you a lot! Keep rocking!

  • @timsandman
    @timsandman Před 6 lety

    So Simple! Wow After a year and a half I got it! Dan's videos are really great to watch. I am learning Java but they translate to any language at a certain level.

  • @k1awdttt
    @k1awdttt Před 5 lety +4

    Just want to let you know that your explanation is very good with great and clear examples. I'd love to see more abstract concepts being explained by you too, like using abstract class in concrete class in OOP designs, invariant and variant, observer vs observable, event-driven design, etc.

  • @Chillaxzino
    @Chillaxzino Před 4 lety +29

    This is my best tutorial on Polymorphism

  • @saadiyafourie
    @saadiyafourie Před 6 lety +1

    YES SIR! You're amazing, appreciate the enthusiastic, relatable way you lay it down. I am so much more confident about Java.

  • @drakulea4301
    @drakulea4301 Před 6 měsíci

    finally an insightful understanding of polym...
    I feel as many people don't grasp the essence of polymorphism and they just see that polymorphism is child classes overiding methods from parents or interfaces, but in reality they are truly missing the point .. which is to create more flexible and reusable code that can accommodate various types of objects. so the power is the fact that you can lets say have a method pet(Animal a) in any other class and any object of a type that inhertis from Animal would be propper argument for that method.

  • @princeofxane
    @princeofxane Před 5 lety +1

    After watching so many videos finally, he explains it beautifully. Thanks.

  • @michalbotor
    @michalbotor Před 6 lety +1

    really cool concept is this polymorphism. and your explanation of this and inheritance was so exceptional. now i finally understand them thoroughly.

  • @magik0630
    @magik0630 Před 4 lety +3

    congrats on your role in casa de papel, you did a great job

  • @systemloc
    @systemloc Před rokem

    Really great. This video is short, efficient, and very effectively communicates the concept. You got another subscriber.

  • @jspesh
    @jspesh Před 5 lety +1

    You are by far the best code teacher!

  • @unicorneyelasers
    @unicorneyelasers Před 4 lety +1

    I absolutely love your enthusiasm! Very enjoyable to watch

  • @benjaminrogers9848
    @benjaminrogers9848 Před 4 lety

    I know I'm a bit late, hope you see this but this was really fun to watch and helped me make a lot of connections of content I knew but couldn't put together until you burst onto the screen with an enthusiasm that students dream of, thankyou!

  • @poloska9471
    @poloska9471 Před 2 lety

    Great video! It was an easy enough beginning to be understandable by pretty much anyone with a programming-afluent mind and towards the end difficult enough to explain polymorphism in actual practice such that a person who doesn't know what polymorphism is, can pick up this principle and run with it to any heights they want to take it - whether that be just one extension of a class or many and usage in complex scenarios with all 3 principles of OOP playing a role.

  • @thekoolcatsesh1932
    @thekoolcatsesh1932 Před 3 lety

    It's funny you say that. I'm not "required" to watch your video, but it is a requirement for my studies to understand object oriented programming in abstraction, inheritance, polymorphism, and encapsulation; but you teach very well, and I understand it. I'm glad you're doing what you're doing.

  • @manuelalfonzoml
    @manuelalfonzoml Před 2 lety

    This guy teaches me more than a university teacher, and does it with such a goddamn passion. Thanks man!!

  • @weltraumimport
    @weltraumimport Před 7 lety +6

    congrats to 200k subscribers!

  • @darkclove7365
    @darkclove7365 Před 5 lety

    Best video that explain polymorphism. Easy example to follow on the whiteboard, easier to follow this than someone trying to explain it in their way on the computer. Me, I knew what it was before going on this video, but had a hard time explaining it well in an easy way, even though it isn't a hard topic in itself. Maybe I'm just dumb.
    Much love!

  • @salmagamal5676
    @salmagamal5676 Před rokem

    YOUR ENERGY IS CONTAGIOUS AND I LOVE IT. thank you!

  • @regardspratik
    @regardspratik Před 5 lety +2

    This guy's enthusiasm is addictive.

  • @jafethgarcia4819
    @jafethgarcia4819 Před 2 lety

    Love the energy you put while teaching, makes it much more interesting! Thank you!!

  • @ketchart2789
    @ketchart2789 Před 3 lety

    Thank you very much!! I really like your teaching style. You're like a ray of sunshine!

  • @Daniel20030
    @Daniel20030 Před 6 lety +49

    "I'll edit that out", always :)

    • @michalbotor
      @michalbotor Před 6 lety

      it's like a running joke among creators these days. ;p

  • @Gregasaurus
    @Gregasaurus Před 5 lety

    great teaching style. dynamic, fun and clear af.

  • @AnthonyJones_Linuxson
    @AnthonyJones_Linuxson Před 6 lety +1

    Thank you so much for this video, I finally understand what Polymorphism means now!

  • @littlecurrybread
    @littlecurrybread Před 3 lety

    omg three textbooks and like five videos and i couldn't understand polymorphism but this video FINALLY helped me understand it, thank you!!!

  • @screwyshow
    @screwyshow Před 4 lety +1

    Extremely happy I came across this video.

  • @holthuizenoemoet591
    @holthuizenoemoet591 Před 5 lety

    simply amazing , your explications are fantastic !

  • @aneiger8706
    @aneiger8706 Před 4 lety

    Absolutely the best video about polymorphism out there!

  • @eddie9559
    @eddie9559 Před 5 lety +2

    third polymorphism video, finally got it. Thanks!

  • @ahmedtabti2264
    @ahmedtabti2264 Před 5 lety +8

    :) very good exempl its very helpful for inderstanding polymorphism ,thanks very mutch ,

  • @ArmyLyra
    @ArmyLyra Před 5 lety

    How i wish you are my teacher. I actually understand you under 8 min and i cannot under my lecturer for the past few months.

  • @emex4gman2
    @emex4gman2 Před 3 lety

    Wow, thanks for this, 6yrs down and this is still valid

  • @davidthewise6617
    @davidthewise6617 Před 4 lety

    truly thank you for this amazing explanation

  • @user-ec1py5nh8d
    @user-ec1py5nh8d Před 5 lety

    Daniel, you are very very good at what you do. a life of meaning and purpose. I envy you Sir!

  • @alda-ir
    @alda-ir Před rokem

    Wow, awesome explanation mate!

  • @ThePersepolis32
    @ThePersepolis32 Před 5 lety +1

    Thanks you, it was very helpful to know what is Polymorphism

  • @fotoh1589
    @fotoh1589 Před rokem

    You give me hope that this world is still livable

  • @Zakariya0101
    @Zakariya0101 Před 3 lety

    Thanks a lot, that was easy to follow and understand from the first minute.

  • @ronglass5968
    @ronglass5968 Před 4 lety

    Thanks for the vid! This was very helpful. Great jumping off point for Polymorphism! (btw, watched the vids on inheritance first; best way to go).

  • @cmarc2156
    @cmarc2156 Před 4 lety

    This is literally the best video on polymorphism in java

  • @uday8112
    @uday8112 Před 6 lety

    Man you are incredible....... how do you do this!?!?
    your videos made my day 💖💖

  • @wing3789
    @wing3789 Před 5 lety

    beautifully explained. Thank you!

  • @ahmedbugti3152
    @ahmedbugti3152 Před 4 lety

    First time saw your video. Couldn't do much just subscribed.. Awesome.

  • @wizardcodes5341
    @wizardcodes5341 Před 4 lety

    Amazing Job man Coherent communication .. salute

  • @kustomweb
    @kustomweb Před 6 lety

    1000 new subscribers every day. Great channel

  • @juniorroberts13
    @juniorroberts13 Před 6 lety

    Awesome. You're a great teacher. :)

  • @GermaphobeMusic
    @GermaphobeMusic Před 4 lety +1

    Previous episode: 12,000 views
    This episode: 100,000 views
    Makes sense.

  • @muhammadovaissiddiqui3895

    Finally understand polymorphism..!! 😍😍👏👏 Thank u sooo much sir for making this video.. ♥️

  • @ratabahmehras4847
    @ratabahmehras4847 Před 5 lety +1

    Wow!! You simply save my day.. ♥

  • @supernovic99
    @supernovic99 Před rokem

    This video was amazing!!! Thank you so much!!!

  • @MsRisani
    @MsRisani Před 3 lety

    You are an awesome teacher! Thank you!

  • @ianr8060
    @ianr8060 Před 3 lety

    You explained polymorphism way better in 8 minutes than my Java teacher did in 2 hours.

  • @SmartProgramming
    @SmartProgramming Před 5 lety

    awesome, just awesome, thanks a ton for the tutorial 👌👌👌👌👍🙂🙂

  • @debajyotibiswas9839
    @debajyotibiswas9839 Před 4 lety

    Such a nice tutorial!!!

  • @austejakazlauskyte2970

    Awesome explanation

  • @kiddba9716
    @kiddba9716 Před 6 lety +1

    I really enjoyed your video!!thank you so much!!

  • @IRWBRW964
    @IRWBRW964 Před 9 lety +3

    Videos 8 and 9 seem to be set as private in this Nature of Code playlist.

  • @ZiadddTV
    @ZiadddTV Před 5 lety

    best explanation ever , thanks

  • @milindshinde5896
    @milindshinde5896 Před 3 lety

    Amazing explanation

  • @primoashbee
    @primoashbee Před 4 lety +1

    El Professor whats up. Excited for season 4!

  • @nicksonmlelwa6583
    @nicksonmlelwa6583 Před 6 lety +1

    Wow it's so nice sir!!!

  • @onionike4198
    @onionike4198 Před 5 lety

    This helps a lot, thanks! 😁

  • @BoutinMathieu
    @BoutinMathieu Před 4 lety

    Very nice job, thank you so much!!

  • @sarvinasalohidinova4881

    It is the best video on this topic

  • @louiscouture9139
    @louiscouture9139 Před 4 lety

    Wow thanks. You made me understand what polymorphism is which my teacher couldn’t

  • @titofrezer6201
    @titofrezer6201 Před 4 lety

    What an explanation !!!! sir
    thank you very much

  • @laubes7481
    @laubes7481 Před 3 lety

    This guy is so incredibly passionete, so good!

  • @cholasimmons
    @cholasimmons Před 4 lety +1

    I wish you taught me programming when I first developed the interest

  • @Zagredful
    @Zagredful Před 2 lety

    Respect to you, understood everything.

  • @sameeruj
    @sameeruj Před 4 lety

    Simply Awesome!

  • @sravanisiva8414
    @sravanisiva8414 Před 3 lety

    Extremely fantastic 😀 thank you very much 😃

  • @CStove
    @CStove Před 4 lety +1

    I love his excitement

  • @randomveda1631
    @randomveda1631 Před 6 lety

    yasss. Finally a FUN java lesson.

  • @hotplugin
    @hotplugin Před 6 lety

    That was fun to look.

  • @Supwisebs
    @Supwisebs Před rokem

    Love you Dan.

  • @gmarifislam4312
    @gmarifislam4312 Před 4 lety

    Happy Teacher, helloo! good to see ya! :D

  • @yeukaimutemachimwe9005

    so interesting good teaching skill halalalaa

  • @mariussurius371
    @mariussurius371 Před 5 lety

    well done, sir.

  • @masouddayaghi5923
    @masouddayaghi5923 Před 5 lety +1

    I wish I could be happy like you

  • @jurjensleebos5058
    @jurjensleebos5058 Před 5 lety

    I so wish you where my teacher right now.

  • @jielyu4943
    @jielyu4943 Před 6 lety

    good video!

  • @omergrn5985
    @omergrn5985 Před 4 lety

    Thnx for logic !

  • @RodrigoNishino
    @RodrigoNishino Před 2 lety

    Very Nice ... I'm THIS CLOSE to dub you in Brazilian Portuguese

  • @karmaindustrie
    @karmaindustrie Před 5 lety +1

    can i write
    for (Dog d : Kingdom) {
    d.sleep()
    }
    ?
    in order to only loop through the dogs.

    • @swastikbhat5874
      @swastikbhat5874 Před 5 lety

      I think this would work but, it would only put the dog to sleep not other animals.

  • @Eltopshottah
    @Eltopshottah Před 4 lety

    I love this guy

  • @urunclesam1659
    @urunclesam1659 Před 4 lety +2

    HOLY MARY MOTHER OF CHRIST THANK YOUUUU

  • @ranjannayyar3863
    @ranjannayyar3863 Před 8 lety

    I have a question. If suppose I add another method into the dog class, which is an extended version of the animals class but this method does not exist in the basic animals class. I want to run that method in the same loop for (animals a: kingdom). I am assuming that is not possible.!

    • @TheCodingTrain
      @TheCodingTrain  Před 8 lety +2

      +Ranjan Nayyar It's possible but you would need to check if the object is a Dog object or not and then cast it as a Dog object. Something like if (obj.getClass().getName() == "Dog").

    • @horstkoston7104
      @horstkoston7104 Před 6 lety

      can you not also do if( a instanceOf Dog){ execute method defined in dog class} ?

  • @kikoarquer
    @kikoarquer Před 5 lety

    Awesome. Thank's.

  • @maxim25o2
    @maxim25o2 Před rokem

    And what if dog.eat(), cat.sleep(), If I loop thru vector, then I want only dog to eat, and cat do nothing. Do cat will be also not called from vector? Or it will be, but function of eat() for cat will not exist, and class cat will return just 0, from base class?

  • @aykhan.g
    @aykhan.g Před 5 lety

    I don't understand after 6.30. What is that class?

  • @sertcow
    @sertcow Před 4 lety

    Wow I wish this guy knew everything in the world so he could teach me.

  • @lazymacs2823
    @lazymacs2823 Před 5 lety

    What are the other situations that polymorphism is useful?