Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Purpose; Create a C++ class, use operators, overloading member functions, friend

ID: 3635299 • Letter: P

Question

Purpose; Create a C++ class, use operators, overloading member functions, friend function, constructors and private data. Make the data members private, (This means that then non-member functions below will have to be friends of the Data.) Create a member function called 'set' with the same arguments, and return type void; and create a constructor with the same arguments. Note that the member function accesses the data members of the object that called it, and a constructor sets the data members of the Data object being created. A member function is called like 'd.set(12,31,1999)'. A constructor is not called a member function. It is used to create an object, which did not yet exist, either in a variable declaration, "Data d(12,31,1999);" Create operator to output a data to an ostream. Write operator ++() and operator++(int) as member functions that do the same thing-change the value that is stored in the object that called them, so that the object contains a date one day later. In addition to doing this, they also return a value. The operator with no formal arguments is called as "++x", and returns the value that is stored in the date after it is incremented. The with a dummy int argument is called as "x++", and returns the value that was stored in the date before it was incremented. Thus, Will print "February 8,2001, February 7,2001, January 2,2001, January 2 2001". Write operator , so that 'a = b' returns true if two dates are the same and false otherwise. It should not be a member function (use friend function). Finally, write a main function that tests all of the functions you wrote. "If a function has a return value, you must demonstrate that the return value is correct. If a function is supposed to change the value stored in a variable, you must test that it did so. Be careful to test both of these properties for both operator++'s.

Explanation / Answer

Hi i have written C++ code on my laptop, but i can't type it and post it here because time expired... please rate me lifesaver and i'll make sure the answer is in your inbox! i don't do this generally but i am doing this due to lack of time...

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote