Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

How many multiples of 4 are there between 10 and 250?

Answered: 1 week ago

Question

How many three-digit numbers are divisible by 7?

Answered: 1 week ago

Question

3. Identify challenges to good listening and their remedies

Answered: 1 week ago

Question

4. Identify ethical factors in the listening process

Answered: 1 week ago