The Department of Computer Science & Engineering
cse@buffalo
STUART C. SHAPIRO: CSE 115 C

CSE 115
Introduction To Computer Science for Majors I
Lecture C
Lecture Notes
Stuart C. Shapiro
Spring, 2001


Polymorphism

Reading
Brown U. Notes, Chapter 5

Can declare a variable to be of one class,
then make it a reference to an instance of a subclass.
When you send that object a message,
the message will be handled by the method appropriate to the object,
not appropriate to the variable.

See Polymorphism demonstration and its documentation.

Also see the definition and use of Appetite in Inheritance demonstration and its documentation.

First Previous Next

Copyright © 2001 by Stuart C. Shapiro. All rights reserved.

Stuart C. Shapiro <shapiro@cse.buffalo.edu>