Because the OpenGate method has the same signature as that required by both the abstract class and Interface, it satisfies both requirements so it compiles OK. If you need different methods to be executed, then you need to explicitly implement the interface version:
public class B1 : Customer, CC
{
public override void OpenGate()
{
Console.WriteLine("B1: Customer");
}
void CC.OpenGate()
{
Console.WriteLine("B1: CC");
}
}
public class B2 : Customer, CC
{
public override void OpenGate()
{
Console.WriteLine("B2");
}
}
Then, you can use them both:
B1 b1 = new B1();
CC cc = b1;
b1.OpenGate();
cc.OpenGate();
B2 b2 = new B2();
cc = b2;
b2.OpenGate();
cc.OpenGate();
And you will get:
B1: Customer
B1: CC
B2
B2