I have the following interface:
interface IExcelServices
{
Dictionary<string, string[]> FilterFields(Dictionary<string, string[]> excelContent);
Dictionary<string, string[]> ParseExcelFile(string path);
}
Which is implemented by the following class:
public class ExcelServices : IExcelServices
{
public Dictionary<string, string[]> FilterFields(Dictionary<string,
string[]> excelContent)
{
//somecode
}
public Dictionary<string, string[]> ParseExcelFile(string path)
{
//somecode
}
private void ReleaseObject(object obj)
{
//somecode
}
}
My code compiles without any problem but I was wondering whether adding a private method (or in general any method) which is not in the interface definition is a good OO programming practice or not.
Of course it is OK to add other members in a class that implements an interface. An interface is just a contract that specifies what the class must implement, but it can also add any members it needs (actually most classes have more members that the ones declared in the interface)