Ask Question
Yesterday, 20:16

A class named clock has two instance variables: hours (type int) and isticking (type boolean). write a constructor that takes a reference to an existing clock object as a parameter and copies that object's instance variables to the object being created. your task: write a clock constructor that makes this possible. just write this constructor - - don't write the whole class or any code outside of the class!

+1
Answers (1)
  1. Yesterday, 23:27
    0
    You can use the initializer list for that; no code needed:

    Clock (const Clock& rClock) : hours (rClock. hours), isTicking (rClock. isTicking)

    {

    / / no code needed

    }

    In fact, the compiler will provide this copy constructor by default, you don't even have to write this constructor!
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A class named clock has two instance variables: hours (type int) and isticking (type boolean). write a constructor that takes a reference ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers