Looking at Allen Lee, base class and interface mixed inheritance declaration issues, a personal view.
Run the following code first:
namespace Test
{
using System;
Interface interface
{
void method ();
Class base class: interface
{
public void method ()
{
Console.WriteLine ("This is the base class method Oh!");
}
Void interface. Method ()
{
Console.WriteLine ("I am an interface-specific implementation Oh, don't run away. ");
}
}
class has no inheritance for interfaces: base class
{
/**////<summary>
///Here only new methods can be used to overwrite
///</summary>
Public New void Method ()
{
Console.WriteLine ("I can only block it with new, however, in idesign Programming specification, new is not recommended. ");
}
}
Class has interface inheritance: base class, interface
{
void interface. Method ()
{
Console.WriteLine ("This Called a remapping of interfaces, it's just a trick thing. ");
}
}
class TestClass
{
[STAThread]
static void Main (string[] args)
{
Base class C1 = new base class ();
C1. method ();
Interface I1 = new base class ();
I1. Method ();
Console.WriteLine ();
Inheritance C2 = new Without interface () No inheritance of interfaces ();
C2. Method ();
Interface i2 = new has no interface inheritance ();
I2. Method ();
Console.WriteLine ();
There is an inherited C3 = New Interface Inheritance ();
C3. Method (); The
Interface i3 = new has interface inheritance ();
I3. Method ();
Console.read ();
}
}
Let's look at the hierarchy of the code's class diagram first.