Object Oriented Programming using Java - Composition - PowerPoint PPT Presentation

About This Presentation
Title:

Object Oriented Programming using Java - Composition

Description:

Validates day value. Dale Roberts. Dale Roberts. Dale Roberts. 5 ... Check if the day is February 29 on a leap year. Dale Roberts. Dale Roberts. Dale Roberts ... – PowerPoint PPT presentation

Number of Views:451
Avg rating:3.0/5.0
Slides: 9
Provided by: dalero
Learn more at: http://www.cs.iupui.edu
Category:

less

Transcript and Presenter's Notes

Title: Object Oriented Programming using Java - Composition


1
Object Oriented Programming using Java-
Composition
Department of Computer and Information
Science,School of Science, IUPUI
Dale Roberts, Lecturer Computer Science,
IUPUI E-mail droberts_at_cs.iupui.edu
2
Composition
  • Composition
  • A class can have references to objects of other
    classes as members
  • Sometimes referred to as a has-a relationship
  • One form of software reuse is composition, in
    which a class has as members references to
    objects of other classes.

3
Outline
  • Date.java
  • (1 of 3)

4
Outline
Validates month value
  • Date.java
  • (2 of 3)

Validates day value
5
Outline
  • Date.java
  • (3 of 3)

Check if the day is February 29 on a leap year
6
Outline
  • Employee.java

Employee contains references to two Date objects
Implicit calls to hireDate and birthDates
toString methods
7
Outline
  • EmployeeTest.java

Create an Employee object
Display the Employee object
8
Acknowledgements
  • Deitel, Java How to Program
Write a Comment
User Comments (0)
About PowerShow.com