Overload operator < < in your Shape class (or LifeForm class) to print information about each shape

Question:

Overload operator<< in your Shape class (or LifeForm class) to print information about each shape (or LifeForm). The arguments to this function should be an ostream \& and a shape \& (or a LifeForm \&). Note that ostream is from the C++ Standard Library (using namespace std;).

You may either provide one function, ostream \&operator<< (ostream \&, Shape \&) ; , and from it call a polymorphic Print(), which is defined in shape and redefined in each derived class. Or, provide multiple operator<< methods to implement this functionality (one for each derived class). If using the Lifeform hierarchy, substitute LifeForm for Shape, in the aforementioned operator<< function signature.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer: