C SC 205 Lecture 2: More OO Concepts
major resources: Data Structures and the Java Collections Framework Second Edition,
William Collins, McGraw-Hill, 2005
Introduction to Programming and OO Design
using Java, Niño and Hosch, Wiley & Sons, 2002
[ previous
| schedule
| next ]
Wednesday September 12 (week 1)
More OO Concepts
- inheritance
- single and multiple inheritance, and the problem with multiple
- polymorphism and dynamic binding
- subclass substitution
- Where an object of a given type is called for, an object of any of its subtypes can be substituted
- example: argument type is subclass of parameter type
- example: assignment sender (right hand side) is subclass of receiver (left hand side)
- goes hand in hand with polymorphism
Unified Modeling Language (review)
OO concepts specific (but not exclusive) to Java
- interface -- a pure specification
- classes that implement an interface
- Note: a Java class can implement more than one interface but can extend only one class
- abstract classes versus interfaces
- Object versus reference equality for objects (equals versus ==, and the default)
- method overloading versus overriding
Javadoc
- basic tags
- invoking Javadoc from command line or jGRASP
- examples
The Employer and Company class hierarchies (case study handout from Collins chap 1)
- interface Employee
- class FullTimeEmployee implements Employee
- class HourlyEmployee extends FullTimeEmployee
- class Company
- class HourlyCompany extends Company
- this case study illustrates all the general and Java OO concepts covered so far
[ C
SC 205 | Peter
Sanderson | Math Sciences server
| Math Sciences home page
| Otterbein ]
Last updated:
Peter Sanderson (PSanderson@otterbein.edu)