Hi,
I need to create overloads for functions on an existing interface without affecting any components that currently implement or make use of the interface (ideally).
I figure I have a couple of options:
Simplified Original interface:
public interface IServerComponent
{
bool Add(int a, int b);
}
I can add the new overloaded functions to the interface and force every class that implements the interface to implement the new functions.
public interface IServerComponent
{
bool Add(int a, int b);
bool Add(int a, int b, int c);
}
Or I can create a new interface that implements the original interface. Then other classes that make use of the original won't need to change and any new classes can implement the new interface...
public interface IServerComponent2 : IServerComponent
{
bool Add(int a, int b, int c);
}
What is the best practice is this situation? Are there any other options available?
Thanks