COIS 2240H Lecture 8: WEEK 8 part 2

64 views2 pages

Document Summary

Things you can do with interfaces: achieve polymorphism. Interfaces are more flexible because a class may implement many different interfaces. Interfaces are preferably used when there is no default. Interfaces are not perfect, they have their drawbacks. *when implementing methods that are from an interface, you always need to override them. Interfaces do not actually contain any method implementations they are simply just templates: abstract classes function like a base class for other classes. Java abstract methods are similar to methods in an interface: they have no implementation simply a method signature. If a class has a single abstract class can be composed of a mixture of abstract and non abstract methods and this is one of the advantages of having an abstract class. In the subclass that is inheriting from the abstract class, every single abstract method must be overridden similar to what you saw with interfaces.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents