课程: Java 8+ Essential Training: Objects and APIs
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
About inheritance and polymorphism - Java教程
课程: Java 8+ Essential Training: Objects and APIs
About inheritance and polymorphism
- [Instructor] I previously described encapsulation, but there are two other concepts that you need to master to be a great object-oriented programmer, inheritance and polymorphism. Inheritance means that there's a relationship between classes in your application that lets you inherit or extend functionality from one class to another. Not all object-oriented languages are the same. For example, C++ supports multiple inheritance, that is one class can inherit functionality from more than one other class. But in Java, there's only single inheritance, each class can extend or inherit functionality from only one other class. This actually makes it a lot easier to manage your code. If you run into a bug, that bug can either be in the class that you're working on or in its direct superclass or in its superclass and so on, but the issue has to be somewhere in that linear path. Java does allow you to implement multiple interfaces in a single class, but we'll get to interfaces later. There are…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。