10-10 Class Notes CS 107

10-10 Class Notes CS 107 - ???????? a. 1. How can we do a...

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

View Full Document Right Arrow Icon
Program 4 has been posted, and is due in two weeks from yesterday. Take a look! Announcements: Questions? Objects and classes. .. Last Time: More on Objects and Classes (continued from last time…) Today: * Here…+ How can we make a copy of an object? [ copy constructor] Deep vs. Shallow copy of an object: Consider having an Employee class that itself has in instance of Date . Create a copy constructor for the Employee class. What happens to the Date? See the employee example done in class Why does changing the startDate for e1 also change it for e2?
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ???????? a. 1. How can we do a deep comparison of objects? [ implement an equals(. .) method ] In the DateDriver.java class: Date d4 = new Date( d3); // make a clone In the Date.java class: // copy constructor // hidden parameter "this" is the one being set Date( Date otherDate) 10-10 Class Notes CS 107 Monday, October 10, 2011 3:58 PM CS 107 Fall 2011 Page 1 month = otherDate.month; day = otherDate.day; year = otherDate.year; { } CS 107 Fall 2011 Page 2...
View Full Document

This note was uploaded on 02/10/2012 for the course COP 2273 taught by Professor Lin during the Fall '11 term at University of Central Florida.

Page1 / 2

10-10 Class Notes CS 107 - ???????? a. 1. How can we do a...

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

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