I am creating an object structure and I want all sub classes of the base to be forced to implement a method.
The only ways I could think of doing it were:
-
An abstract class – Would work but the base class has some useful helper functions that get used by some of the sub classes.
-
An interface – If applied to just the base class then the sub classes don’t have to implement the function only the base class does.
Is this even possible?
N.B. This is a .NET 2 app.
You can have abstract methods in a class with other methods that are implemented. The advantage over an interface is that you can include some code with your class and have the new object be forced to fill in the details for the abstract methods.