Question: Instructions: ccc_Time is a class that describes the current time of day. Clock constructs a clock that gives the current time of day. It can
Instructions:



ccc_Time is a class that describes the current time of day. Clock constructs a clock that gives the current time of day. It can be displayed in regular (1:09) or military time (13:09)Polymorphism We have been dealing with three different clocks in the main, one regular clock and two travel clocks. It might be practical to host all clocks in a single vector. We will use what we call polymorphism to do this. 1. Create a vector named \"clocks\" that contains pointers to clocks (clock *1. a. Feel free to use an array if you aren't used to using the standard library's Vector class. 2. Insert clockl, clock2 and clock3 into this vector. Remember that you created regular variables before and how you need to give pointers, so you will need to add something to make it work. 3. Create a loop that will iterate through all the elements in the vector (from U to the size of the clocks}. For each loop, print the clock number, and the same information as was printed before [i.e. modify the previous cout to make them work with elements of the vector clocks you need to access the elements, change how you access their attributes/methods since they are pointers]. 4. Run this program. Does it display the right time for every clock? The problem comes from the fact that when you do clocksii]->get_hours() it does not know whether the object is a Clock or a TravelClock, so by default it uses the Clock function. Let's illustrate it more clearly. 5. Create a function named test in both Clock and Travelclock. The function doesn't return anything, but prints out the name of the class. This is the example for Clock. Modify its content for TravelCIock. void test{) { cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
