Computer Science Fundamentals (CS153 2003S)
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
Back to Inheritance. On to Polymorphism Example.
Held: Friday, 11 April 2003
Summary: Today we consider issues of polymorphism. In essence, polymorphism is the ability to use a variety of objects with similar capabilities in the same way (e.g., as parameters to the same procedure).
Related Pages:
Assignments:
Notes:
Overview:
DrawableCircle is both a circle and a
drawable object.
public interface Drawable {
/** Clear and useful comment. */
public void drawYourself(Color baseColor,
double scaleFactor,
int top,
int left,
DrawingArea sketchPad);
/** Clear and useful comment. */
public int getWidth();
/** Clear and useful comment. */
public int getHeight();
...
} // interface Drawable
public class DrawableCircle
extends Circle
implements Drawable
{
....
} // class DrawableCircle
implementsis a contract. You promise to implement all the methods described in the
Drawable interface.
Prerequisite class and variant
issues.
abstract as one of the adjectives
describing the class (in addition to public and whatever
else you think is appropriate).
Thursday, 15 January 2003 [Samuel A. Rebelsky]
Thursday, 10 April 2003 [Samuel A. Rebelsky]
Friday, 11 April 2003 [Samuel A. Rebelsky]
Back to Inheritance. On to Polymorphism Example.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[EC]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Lab Writeups]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Misc:
[Experiments in Java]
[Scheme Reference]
[Scheme Report]
[CS153 2002S (Walker)]
[CS151 2003S (Rebelsky)]
[CS152 2000F (Rebelsky)]
[SamR]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Tue May 6 09:20:59 2003.
The source to the document was last modified on Fri Apr 11 09:05:12 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS153/2003S/Outlines/outline.40.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby