Questions
- Overload
operator=
in yourShape
exercise from Chapter 8, Mastering Abstract Classes, or alternatively, overloadoperator=
in your ongoingLifeForm
/Person
/Student
classes as follows:
Define operator=
in Shape
(or LifeForm
) and override this method in all of its derived classes. Hint: the derived implementation of operator=()
will do more work than its ancestor, yet could call its ancestor’s implementation to perform the base class part of the work.
- Overload
operator<<
in yourShape
class (orLifeForm
class) to print information about eachShape
(orLifeForm
). The arguments to this function should be anostream &
and aShape &
(or aLifeForm &
). Note thatostream
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...