Question: short c++ question: Code Writing The Animal class is a superclass for Animal objects, and it has the public member methods virtual void eat(), virtual
short c++ question:

Code Writing The Animal class is a superclass for Animal objects, and it has the public member methods virtual void eat(), virtual void sleep(), and virtual std::string getStatus(). getStatus will always return either hungry, sleepy", or happy. Write a void function that takes an array of Animal pointers and its size as parameters. If any pointer in the array is pointing to nullptr, throw an instance of std::runtime_error. Otherwise, for each Animal pointer in the array, if the Animal that is being pointed to has a status of hungry, call eat() on it. If its status is sleepy, call sleep on it. If its status is happy, do not call any methods on it. #include "Animal.h" #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
