What's the name for a class that has only methods? There are no fields/properties. Just two methods with the ability to parse some file in two ways. I have named the class Parser, but it just doesn't seem right to have a class do only that. Or?
Should it be in a class ?
EDIT:
Dummy Example
class Parser
{
public int parseMethod1(string file)
{
//parse & return
}
public string[] parseMethod2(string file)
{
//parse & return
}
}
How could I write an interface IParser
which allowed me to have a subclass only implement one of the methods?
Parser
be an interface? Without more context, all we can do is to take a wild guess. – amon Feb 3 at 22:31Should it be in a class ?
- it is in a class, isn't it? And where else could it be (in C#) – Konrad Morawski Feb 3 at 22:34interface Parser<T> { public T parse(string); }
class SomeParser implements Parser<int> { public int parse(string file) { ... } }
(sorry, I'm used to Java syntax) – amon Feb 3 at 22:55