public interface IA
{
void DoSomething();
void Calculate();
}
public interface IB
{
void DoSomethingElse();
void Calculate();
}
public class A : IA
{
void DoSomething() { }
void Calculate() {}
}
public class B : IB
{
void DoSomethingElse() { }
void Calculate() {}
}
public class C : IA, IB
{
//How can I implement Calculate() in class B and DoSomething() in class A?
}
How can I avoid duplicate code in class C. Reference: How to simulate multiple inheritance in C#. I don't want to write the full methods again in class C. Thanks for any help.
AandB.Cyou'll need to explicitly implement bothIA.Calculate()andIB.Calculate().