CS 18000 Chapter 17: Polymorphism

40 views1 pages

Document Summary

Java allows a superclass variable to contain a reference to a subclass object. The compiler chooses the subclass implementation of any overridden methods. Declaring an abstract class means that it cannot be instantiated. But an abstract class may also include some implemented methods for default behavior. Some methods may be implemented (just like an interface) Methods are selected at runtime based on the class of the object references, not the class of the variable that holds the object reference. Binding refers to the connection between the name of the method and the method body being called. Programmer must be disciplined: the overridden methods should implement consistent or expected behavior. Methods may be declared abstract: provide only the header (no body, class must then be declared abstract. Methods in an interface are implicitly declared abstract.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents