Question: // ClockMain.cpp #include #include Clock.h using namespace std; // Advance the clock by one hour with a value parameter void advanceOneHour Val(Clock myClock) {

// ClockMain.cpp #include #include "Clock.h" using namespace std; // Advance the clock by one hour with a value parameter void advanceOneHour Val(Clock myClock) { myClock.advanceOneHour(); } // Advance the clock by one hour with a pointer parameter void advanceOneHourPtr(Clock * myClock) { myClock->advanceOneHour(); } // Advance the clock by one hour with a reference parameter void advanceOneHourRef(Clock & myClock) { myClock.advanceOne Hour(); } int main() { } // Create a Clock with ID number 42 clock c1(42); cout < < "Setting the clock to 2:03:04 using normal setters" < < endl; c1.setHour(2); c1.setMinute (3); c1.setSecond(4); c1.printTime(); cout < < "Advancing the clock one hour with a value parameter" < < endl; advanceOneHour Val(c1); c1.printTime(); cout < < "Advancing the clock one hour with a pointer parameter" < < endl; advanceOneHourPtr(&c1); c1.printTime(); cout < < "Advancing the clock one hour with a reference parameter" < 1. Analyze the output from the function calls in ClockMain.cpp. Which of these function calls compile? Which set the Clock to the correct new time? c1.setHour(2);c1.set Minute(3);c1.setSecond(4); c1.setHourins(8).setMinutelns(9).setSecondins(10); c1.setHourPtr(5).setMinutePtr(6).setSecondPtr(7); c1->setHourPtr(5)->setMinutePtr(6)->setSecondPtr(7); c1.setHourPtr(5)->setMinutePtr(6)->setSecondPtr(7); c1.setHourRef(11).setMinuteRef(12).setSecondPtr(13); advanceOneHourVal(c1); advanceOneHourPtr (&c1); advanceOneHourPtr(c1); advanceOneHourRef(c1); 2. Which of these methods can be declared as const? Why or Why not? Normal Setters Cascading Setters Getters advanceOneHour() Printing Methods Compiles? (YES/NO) Can declare const? (YES/NO) Correct Time? (YES/NO) Why or Why Not?
Step by Step Solution
There are 3 Steps involved in it
To answer these questions we need to make some assumptions about the implementation of the Clock class since the actual class definition is not provid... View full answer
Get step-by-step solutions from verified subject matter experts
