lundi 5 septembre 2016

Best Practice for validation if a object can be handled

image we have a class named RotationClass, which rotates GeoObjects (Triangle, Circle, Line).

In the Class we have 3 Methods:

RotateTriangle()
RotateCircle()
RotateLine()

....

so someone gives a List of GeoObjects to my class and they all get rotated with their specifit Rotate-Method.

But now ... there is a new GeoObject Rectangle..... How can i implement a Methode like "CanRotateGeoObjectList"? The Method should check if there ist a Rotate-Method for every GeoObject.

Hope you understand

Aucun commentaire:

Enregistrer un commentaire