课程: Java Object-Oriented Programming
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Solution: Leverage abstraction to write simpler applications - Java教程
课程: Java Object-Oriented Programming
Solution: Leverage abstraction to write simpler applications
(upbeat music) - [Instructor] Let's reduce complexity and code duplication in our event program. We started off with the event interface and this will remain the same. However, instead of each custom event class implementing the interface, we'll have an abstract event class that implements event. Before the timestamp and ID attributes were duplicated across each event. Here, we've put the attributes in a single place, the abstract event class. The implementation of getTimestamp was also duplicated, so we've put it in this common class. Now this is an abstract class, so we can not create instances from it directly, rather other event classes we'll extend this class with more functionality. In that extension the abstract method process will need to be implemented. Let's take a look at how the password change event has changed. Instead of implementing the event interface, this class extends abstract event. In its…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
-
-
-
-
(已锁定)
What is abstraction?1 分钟 47 秒
-
(已锁定)
Using abstract classes in Java to reduce code complexity5 分钟 59 秒
-
(已锁定)
Using interfaces in Java to provide conformity5 分钟 1 秒
-
(已锁定)
Discovering abstraction in Java source code4 分钟 55 秒
-
(已锁定)
Challenge: Leverage abstraction to write simpler applications1 分钟 19 秒
-
(已锁定)
Solution: Leverage abstraction to write simpler applications2 分钟 58 秒
-
(已锁定)
-