Java Programming: Lesson 32 - Polymorphism
Описание
PLEASE SUBSCRIBE!!!
In the previous lesson (https://youtu.be/ayQ7gIrnDuk), we introduced the concept of inheritance. Here, we review the fundamentals of inheritance and continue our discussion to include polymorphism. We need to explicitly cast an "under-declared" object to a subclass in order to use any methods that were not defined until the subclass. This can easily be done in one line.
If an object is declared in the superclass but instantiated in the subclass, and the superclass has a method M that is overridden in the subclass, then the object will use the subclass's version of that method rather than the superclass's version. HOWEVER, the object will not be able to use any methods that did not appear in the superclass until it is explicitly cast into the subclass.
0:19 Review of OOP Fundamentals
1:35 Review of Inheritance, Overriding Methods, and the super Keyword
7:18 NEW: Object Class and Overriding its toString() Method
9:23 Another Example of Overriding Methods
13:58 NEW: Polymorphism
17:14 NEW: Explicit Cast to a Subclass
Ready for abstraction? Our discussion of inheritance is more or less continued in the next video https://youtu.be/UvG7Pn5GMPs (lesson 33)
Thanks for watching, and PLEASE SUBSCRIBE!!!
Рекомендуемые видео



















