Question: In my C++ class we are working on this project. I did a lot of the project but I am not good with operator overloading

In my C++ class we are working on this project. I did a lot of the project but I am not good with operator overloading and pointers and need some help.

Functions I need help with:

myClock operator++();

//overload ++ operator as a member function. t++ will increase the seconds by 1.

int operator-(const myClock& t);

//overload - as a member function. t1-t2 returns the difference in seconds between t1 and t2

In my C++ class we are working on this project. I did

myClocklmp.cpp Problem 4 myClock.h* a x mainTest.cpp #ifndef MYC LOCK H #define MYCLOCK H #include iostream 2 using namespace std; //implement a class that mimics a clock. 24 hr clock, ?.e. from 00:00:00 to 23:59:59 9 10 ?class myClock friend ostream& operatorss (ostream&, myClock&); /loverloadt2 returns true if the time represented by t1 is later in the day than t2 public: 19 20 21 //default constructor: sets time to h:m:s (00:00:00 if no parameters passed), // If any of h, m or s is not "legal", then set it to e 23 24 25 26 27 28 29 30 31 void set(int h, int m, int s); //sets the time to h:m:s // If any of h, m or s is not "legal", then set it to e void reset); //resets time to 00:00:00 int operator (const myClock& t); //overload as a member function. t1-t2 returns the difference in seconds between t1 and t2 34 36 37 myClock gprater); /loverload operator as a member function. t++ will increase the seconds by 1 39 40 42 private: int hours; int minutes; int seconds; 43 45 46 47 48 49 #endif#pragma once

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!