CS 326
Object-Oriented Design, Winter 2007,
Instructor: Jeffrey Horn
CONTENTS
public override double area_of_overlap(Shape other)
overrides the virtual version of the method in Shape. Furthermore, the overriding methods should use the faster algorithms for calculating overlap if the "other" Shape object that they are passed is the same class as themselves (i.e., a Circle being asked to calculate overlap with another Circle, or a Square with a Square). But if the other is different, then your method should use the more general, and cruder, algorithm inherited from Shape (i.e., "base.area_of_overlap()"). In this way, the Population can hold different shapes (e.g., both Circles and Squares) and the RFS evolution will still work!