I have a hierarchy of classes, where I have to overload operator+
and operator-
so that it produces a new type like so.
Animal * pg = new Pigeon();
Animal * pgone = new Pigeon();
Animal * babypigeon = *pgone + *pg;
Where Animal
is the base type and Pigeon
is a derived type. I wondered if I should just overload the operators on the derived type or do I need to overload the base type's operators too?
Assuming that all derived types will be created using a base pointer.