Ask Question
31 March, 09:48

What methods would you add to make this class declarationvery useful?

Class Cat

{

int GetAge () const;

private:

int itsAge;

};

+4
Answers (1)
  1. 31 March, 10:23
    0
    void SetAge (int age), void meow ()

    Explanation:

    Since the class has an itsAge variable as private and has a GetAge () method. There should be a SetAge () method to set the value of the age.

    Also, since it is a Cat class, it is better to have a method that mimics the voice of the cat, meow ()
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What methods would you add to make this class declarationvery useful? Class Cat { int GetAge () const; private: int itsAge; }; ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers