If you want to have a constructor that accepts string input, you need to implement an abstract class:
public abstract class BaseClass<T>
{
public BaseClass<T>(string input)
{
DoSomething(input);
}
protected abstract void DoSomething(string input);
}
Then your derived class simply provides an abstract method implementation, and it can then get any interfaces it needs.
public class Sample<T> : BaseClass<T>, IMyInterface
{
public Sample<T>(string input)
: base(input)
{
}
protected override void DoSomething(string input)
{
}
public void MyInterfaceMethod()
{
}
}
Tejs source
share