13InterfacesWrappersLarge

13InterfacesWrappersLarge - Lecture Set #13: Interfaces 1....

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CMSC 131 Fall 2007 Jan Plane (Adapted from Bonnie Dorr) Lecture Set #13: Interfaces 1. Interfaces 2. Wrappers CMSC 131 Fall 2007 Jan Plane (Adapted from Bonnie Dorr) 1 Code Re-use c Many operations recur in programming c sorting c max / min (These operations may apply to strings, numbers, etc.) c Desirable: one implementation! c Less coding c Less likely to have typos c Easier maintenance of code
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 CMSC 131 Fall 2007 Jan Plane (Adapted from Bonnie Dorr) 2 Polymorphism c Using an interface we can create one variable that can reference objects of different types (i.e. UMStudent variable referencing CSMajor, CEMajor or PsychMajor) c This form of “generalization” is called polymorphism c Hallmark of OO languages c Allows application of same code to objects of different types c Polymorphism: “A variable that takes on many shapes.” c Interfaces: one mechanism Java provides for polymorphism c a collection of prototypes (method prototypes but no bodies) aka abstract methods c A class C
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/05/2009 for the course CMSC 131 taught by Professor Plane during the Fall '08 term at Maryland.

Page1 / 4

13InterfacesWrappersLarge - Lecture Set #13: Interfaces 1....

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online