r/javahelp • • Nov 17 '19

How do I implement those two function?

Date is a class name. It contains three private datatype int day, month, year.

m. Return a reference to the object containing a copy of the date.

n. Make a copy of another date. Given a reference to an object containing a date, copy the data members of the object into the corresponding data members of this object.

Please give me an example how the function prototype should look like.

Edit:

I have to implement all the method here : http://prntscr.com/py9chy

I almost done except for m and n. Here is my work: https://pastebin.com/JnqhYzBA

0 Upvotes

5 comments sorted by

View all comments

1

u/[deleted] Nov 17 '19 edited Nov 17 '19

Why not write a class called Date that has three private datatype int day, month, year? Then create objects of that class? Use getters of the "date" class to create the second object, thereby "copying" the information from a previous "date" object?

0

u/TD123TD Nov 17 '19

Updated