Hello,
I have a several C# classes called ShapeA, ShapeB, ShapeC, etc. and collection class called ShapeCollection. they all inherit from an abstract class called Geometry. All of these classes arrive from a 3rd party assembly, so I can't change them.
I want too add a new method to all of these Shape classes, let's call it Paint(), and implement this method in a different way for each Shape class. The ShapeCollection class will just call this Paint() method on each shape class in the collection.
The most straight-forward way I thought of doing this is to make a new class for each shape class that will inherit from the original shape class but will also implement an interface that will contain the Paint() method.
I'm really trying to avoid in creating a derived type for each of these shape, because there are many shape classes.
What is the correct way to do this? Any help will be appreciated.
Thank you,
Kathy