Features of the interface:
1. Multiple inheritance interfaces and classes can inherit multiple interfaces
2. Interface members cannot contain modifiers such as new, abstract, rewrite, etc.
Simple application of the interface:
namespace interface_Demo { class Program
{
static void Main(string[] agrs)
{
Appearance Name1=new Name1();
Appearance Name2=new Name2();
Name1.work("Beautiful");
Name2.work("Handsome");
}
}
public interface Appearance{void face(string s);}
class Name1:Appearance
{
public void face(string s)
{
Console.WriteLine("我长得很"+s);
}
}
public interface Appearance{void face(string s);}
class Name2:Appearance
{
public void face(string s)
{
Console.WriteLine("I look good"+s);
}
}
}