我是C#的新手.现在在阅读Interfaces时.我很困惑.我在MSDN上读到我们无法直接实例化接口.后来他们写了下面的例子.
Public interface ICat
{
meow();
}
Public class Cat : ICat
{
meow(){//do something }
}
////////////////////
static void main(){
Icat cat = new Cat();
Cat cat1 = nes Cat();
}
Run Code Online (Sandbox Code Playgroud)
如果我们不能直接实例化Interfaces那么Icat cat = new Cat();这一行的含义是什么.那么这两者之间有什么区别?