1. The problem is at first
Today, looking at the feedback from the article "Interface inheritance declaration issues", I found that ninputer left such a question:
If there is
Class A:interface1
So
Class B:a, Inteface1
And
Class B:a
What would be the difference? What does the compiler do with the IL level to achieve this functionality?
2. Exploring Questions & Understanding issues
The process of solving a problem is both a process of exploration and a process of reasoning and argumentation. OK, I'm going to try to use contradiction to explore this problem.
First, I assume that the two types of inheritance of Class B in the question have the same effect and try to find them differently. To understand the effects of both approaches, I added the above code to complete:
interface IC { }
class A : IC { }
class B1 : A { }
class B2 : A, IC { }
class Program
{
static void Main()
{
A a = new A();
B1 b1 = new B1();
B2 b2 = new B2();
Console.WriteLine(a is IC);
Console.WriteLine(b1 is A);
Console.WriteLine(b1 is IC);
Console.WriteLine(b2 is A);
Console.WriteLine(b2 is IC);
}
}
The results of the code run are:
True
True
True
True
True