1 / 8

Object Oriented Programming using Java - Composition

Department of Computer and Information Science, School of Science, IUPUI. Object Oriented Programming using Java - Composition. Dale Roberts, Lecturer Computer Science, IUPUI E-mail: droberts@cs.iupui.edu. Composition. Composition

Download Presentation

Object Oriented Programming using Java - Composition

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Department of Computer and Information Science,School of Science, IUPUI Object Oriented Programming using Java- Composition Dale Roberts, Lecturer Computer Science, IUPUI E-mail: droberts@cs.iupui.edu

  2. Composition • Composition • A class can have references to objects of other classes as members • Sometimes referred to as a has-arelationship • 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 contains references to two Date objects • Employee.java Implicit calls to hireDate and birthDate’s toString methods

  7. Outline • EmployeeTest.java Create an Employee object Display the Employee object

  8. Acknowledgements • Deitel, Java How to Program

More Related