I know the question is confusing, but it is hard to think of a good title for this problem, so I'll describe more here.
I have an interface A with 2 methods, IsValidRow()
and IsFileValid()
I have a base class B and a derived class C
The goal here is that I want the base class to implement IsFileValid()
, so it can be inherited by all the classes derived off the base class and each derived class to implement IsValidRow()
.
The problem is that IsFileValid()
calls IsValidRow()
inside. If I do
B:A
A requires IsValidRow()
to be implemented in B.
Currently my derived class C inherits from the base class and the interface atm.
I don't mind restructuring everything as long as the requirements for the 2 methods are fulfilled (One will be implemented once in a base class or something and inherit across, while the other one will be implemented in each derived class)
interface IFileValidator
{
Pair<bool, string> IsValidRow(List<string> row);
bool IsFileValid(string file);
}
class FileValidator : IFileValidator
{
public bool IsFileValid(string file)
{
// calls IsValidRow()
IsValidRow();
}
}
class FacilitiesCalendarValidator : FileValidator, IFileValidator
{
public Pair<bool, string> IsValidRow(List<string> row)
{
//stuff
}
}