课程: Java Object-Oriented Programming
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
What is polymorphism?
- [Instructor] Polymorphism is the ability for an object or function to take many forms. Depending on the context and situation, the form may be different, making your code more flexible and reducing complexity. In fact, we've already started using it in this course, even if we didn't realize it. If we look at our example from the previous challenge, the ModArrayList instance takes a few different forms. When we use its getUsingMod functionality, we are using it in the form of a ModArrayList. However, when we use the add functionality, we're using it as an array list. In fact, if we click into the add functionality, it won't take me to the ModArrayList class, rather the ArrayList class. This is where that functionality is defined. The idea that an object can use functionality from different classes depending on the context is a key idea that's essential to understanding polymorphism. Java supports two types of…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
(已锁定)
What is polymorphism?1 分钟 22 秒
-
(已锁定)
Writing reusable algorithms with runtime polymorphism4 分钟 47 秒
-
(已锁定)
Exploring different forms in a single object4 分钟 6 秒
-
(已锁定)
Accessing specific object forms with instanceof4 分钟 23 秒
-
(已锁定)
Writing flexible code with compile-time polymorphism4 分钟 38 秒
-
(已锁定)
Exploring how built-in Java classes use polymorphism3 分钟 39 秒
-
(已锁定)
Challenge: Reduce complexity with polymorphism48 秒
-
(已锁定)
Solution: Reduce complexity with polymorphism6 分钟 57 秒
-
(已锁定)
-
-