I suppose this is somewhat of a design question too. Is it possible to override a method from an interface when the overriding signature has a different signature type?
For example, lets say that I want two different classes that should have the following:
interface IProtocolClient
{
void connect(Type1 t1, Type2 t2, Type3 t3);
}
Would it be possible to impelemt the interfrace but have a different parameter set?
class A : IProtocolClient {
public void connect( Type1 t1, Type2 t2, Type3 t3 ) {}
}
class B : IProtocolClient {
public void connect( Type1 t1, Type2 t2, Type3 t3, Type4 t4 ) {}
}
Or should I approach this by creating a base class instead, and then create a wrapper method in class B such as:
class B : IProtocolClient {
public void connect( Type1 t1, Type2 t2, Type3 t3, Type4 t4)
{
// do what is needed with t4 to customize and then ...
connect(t1,t2,t3);
}
public void connect( Type1 t1, Type2 t2, Type3 t3) {}
}