Inheritance & Polymorphism

Поділитися
Вставка
  • Опубліковано 19 жов 2024

КОМЕНТАРІ • 46

  • @manavsaxena5579
    @manavsaxena5579 9 років тому +9

    Thank you so much! was really waiting for this!

  • @dongxuandong
    @dongxuandong 8 років тому +3

    Your videos are really awesome and easy to understand. You explain different theories of programming with good examples. I hope in the future, you will make more videos about programming and on Java. Keep up the good work!

    • @NERDfirst
      @NERDfirst  8 років тому

      +Zhendong Liu Hello and thank you very much for your comment! Unfortunately I tend to keep away from syntax related videos since (unlike CS1020), my main focus is on concepts and theories, and making them easier to understand! Hopefully most of the things here will still remain applicable though, since if you can see the big picture (which is what I'm aiming for), then learning the actual algorithms will become easier.

  • @course4classmuchmore182
    @course4classmuchmore182 2 роки тому

    Why are you so much better than my professor? Nicely done. I learned more in your short chapter than 50 pages of my book and 4 hours of professor lecture

    • @NERDfirst
      @NERDfirst  2 роки тому

      Hello and thank you very much for your comment! I'm a lot less formal and precise than in a classroom setting, that's probably why. Take this as a primer to the subject matter, but absolutely do revisit your class content, which I'm sure goes into much further depth and is more actionable!

  • @janenenewbegin4083
    @janenenewbegin4083 3 роки тому

    So much useful information packed into such a short video. Love it!

    • @NERDfirst
      @NERDfirst  3 роки тому

      Hello and thank you very much for your comment! Very happy to be of help :)

  • @x9466x
    @x9466x 4 роки тому

    My favorite & goto channel whenever I need something explained again

    • @NERDfirst
      @NERDfirst  4 роки тому +1

      Hello and thank you very much for your comment and support! Glad to be of help =)

  • @10yearsfan06
    @10yearsfan06 5 років тому +1

    This cleared up a lot of things for me! You saved me a lot of frustration. Thank you!! :D

    • @NERDfirst
      @NERDfirst  5 років тому

      You're welcome! Very happy to be of help =)

  • @frenchcroc5065
    @frenchcroc5065 4 роки тому +1

    so much better than the slides in my java class, thanks

    • @NERDfirst
      @NERDfirst  4 роки тому

      You're welcome! Glad to be of help =)

  • @BarryMcGowan
    @BarryMcGowan 5 років тому

    Very good explanation. Very clear. Cheers!!!

    • @NERDfirst
      @NERDfirst  5 років тому

      Hello and thank you very much for your comment! Glad you liked the video =)

  • @DanielAnderssson
    @DanielAnderssson 5 років тому +5

    5:09 I agree

  • @Swiizzey
    @Swiizzey 9 років тому

    Can I suggest a video topic? The keyword static. I have and watched videos about it and still don't understand what exactly it is and when is it necessary to use.

    • @NERDfirst
      @NERDfirst  9 років тому +1

      +Swiizzey Oooh, that is definitely a good thing to talk about! But for now, let me answer your question in text, because I don't know when is the next time I'll get to shoot a video.
      A static function is associated with the *class*, while non-static functions are associated with *objects* (ie. Individual instances of a class). So for the ball example shown in the video, "kick" is associated with the individual balls, ie you can kick _a_ ball, but you can't kick the _definition_ of ball.
      If we like, we can add some things to the existing class, perhaps in this form:
      class Ball {
      private static int count = 0;
      public Ball( ... ) {
      ...
      count++
      }
      public static int getCount() {
      return count;
      }
      }
      Meaning, every time I create a new ball, the count increases by one. Clearly, "count" is an information that cannot be associated with instances of the Ball class (I couldn't look at _one_ ball and somehow figure out how many balls there are in the world). However, because this information is held by the ball *class*, I can simply query this at any time, by saying Ball.getCount(). The count is information associated with the *class*.
      Is this clear enough? I think I got a bit too rambly there. Let me know if you need any further clarification.

    • @Swiizzey
      @Swiizzey 9 років тому

      Yeah now I understand it much better. Thanks m8

    • @NERDfirst
      @NERDfirst  9 років тому

      +Swiizzey Cheers! Glad to be of help =)

    • @Gargantupimp
      @Gargantupimp 7 років тому

      0612 TV w/ NERDfirst nice you rock at explaining.

  • @zeekv8925
    @zeekv8925 6 років тому +2

    Best explanation ever saw :)

    • @NERDfirst
      @NERDfirst  6 років тому

      Hello and thank you very much for your comment! Very happy to be of help =)

  • @hypnosisspl
    @hypnosisspl 9 років тому

    Hey, could you consider make a video about object recognition using classifiers (can be opencv) and/or how train your classifier :) Anyway, Will be not bad idea to do a set of videos explaining methods of pattern recognitions :)

    • @NERDfirst
      @NERDfirst  9 років тому

      +Hypnosiss Hello and thank you for your comment! I am currently taking a course in school on computer vision and pattern recognition, and to be honest, waaay too much of it is going over my head for me to be confident in doing a video on it! When it comes to recognition using classifiers, well, machine learning is one of the things furthest outside my specialization too, so I'm worried I wouldn't be able to provide much insight.
      However having said that, I did make a video on machine learning (very much in general), and I did actually set up an experiment on very simple shape recognition in that video. I don't go into detail on _anything_ really, so it's probably not what you're looking for. But if you'd like to check it out, here it is: ua-cam.com/video/REaLt09fD80/v-deo.html

    • @hypnosisspl
      @hypnosisspl 9 років тому

      Hey! I am also taking a course at my university :) Field is quite interesting in particulary that is continously deploying around us (number plate recognition, traffic analyzing, products recognition et cetera). If you have some more knowledge about it, share with others it will be very usefull, specially if it is explained explicitly :)
      Thanks for a link!

    • @NERDfirst
      @NERDfirst  9 років тому +1

      +Hypnosiss I'll see what I can do! Like I said a lot of it is going over my head so I don't know how much I'm confident to speak about, but I can probably talk about the more basic stuff.

  • @Shadow4707
    @Shadow4707 9 років тому

    That balltest array is just an array of pointers, isn't it? Otherwise you wouldn't have been able to instantiate the subclasses because there might not have been enough memory allocated, right?

    • @NERDfirst
      @NERDfirst  9 років тому

      +Shadow4707 Hello and thank you for your comment! That is indeed correct. I'm no expert at this, but from what I understand, in Java we can assume everything is a reference of some kind. So yes, there will be some logisitical difficulties if this was not the case.

    • @TheAl_T
      @TheAl_T 9 років тому

      +lcc0612 Everything is reference except for primitive types (default types that start with lowercase letter i.e..: int, double...)

    • @NERDfirst
      @NERDfirst  9 років тому +1

      +TheAl_T Thank you for your comment! I forgot about the primitive types, but yes, that makes a lot of sense =)

  • @supamdeepbains5172
    @supamdeepbains5172 5 років тому

    OMGGGG WHY DID'NT SEEE THIS BEFORE , THANKS MAN MAKE IT ON GUI JAVA PLS

    • @NERDfirst
      @NERDfirst  5 років тому

      You're welcome! I'm not an expert on Java GUI to be honest, but I'll see what I can do!

  • @bigshaqsmathematicalinstit3318
    @bigshaqsmathematicalinstit3318 5 років тому

    Nice video bro!

    • @NERDfirst
      @NERDfirst  5 років тому

      Hello and thank you for your comment! Glad you liked the video =)

  • @daymeonthompson6538
    @daymeonthompson6538 4 роки тому

    Good content

    • @NERDfirst
      @NERDfirst  4 роки тому

      Hello and thank you for your comment! Glad you liked the video =)

  • @AlexanderBollbach
    @AlexanderBollbach 9 років тому

    great videos

    • @NERDfirst
      @NERDfirst  9 років тому

      +Alexander Bollbach Thank you very much! Glad you like my work =)

  • @tonydang3857
    @tonydang3857 7 років тому

    1. is a child object also a parent object? 2. is a parent object also a child object?

    • @NERDfirst
      @NERDfirst  7 років тому

      Hello and thank you for your comment! Firstly - Be careful of your terminology! When we're talking about inheritance, we're talking about building *class* definitions that inherit off another class! Therefore when we're going on about parent/child relationships, they must be in relation to classes, *not objects*!
      Anyway to answer your question - A parent class can certainly be a child class, and vice versa - But not of each other! Take a look at this example: Animal → Mammal → Cat. Mammal is the child class of Animal, and the parent class of Cat.
      However, you cannot have a class that is both the parent and child of another class. This creates a cyclic inheritance that can never be made sense of!

    • @tonydang3857
      @tonydang3857 7 років тому

      Isn't a child object IS A also a parent object? But isn't a parent object IS NOT A child object?

    • @tonydang3857
      @tonydang3857 7 років тому

      is every Java class a subclass???

    • @NERDfirst
      @NERDfirst  7 років тому

      Hello again! Please clarify on your question "Isn't a child object IS A also a parent object? But isn't a parent object IS NOT A child object?" - As explained above, a child (or sub-) class, can be the parent (or super-) class of another object.
      And yes, in Java, every class extends the Object class, and as such every class is a subclass.