I'm a self taught hobbyist programmer and all my knowledge is derived from seeing what the compiler does and doesn't like.
Suppose I have (in C# notation, Java may have other abilities)
The class I need to override looks like this:
public interface ICanDoSomethingElse
{
void DoIt();
}
class Parent : ICanDoSomethingElse
{
public void EatTacos()
{
}
void ICanDoSomethingElse.DoIt(string thingToDo)
{
// Implementation
}
}
So I do this:
class Child : Parent, ICanDoSomethingElse
{
new public void EatTacos()
{
}
void ICanDoSomethingElse.DoIt(string thingToDo) // NEW keyword illegal here?
{
// Implementation
}
}
Question
I observe that the new keyword is illegal in the interface. Is that because this is an explicit Interface?
Is there any way to force children to implement an interface, or does that just mean I need to set up an implicit/explicit cast?