什么冒号(:))是指在C#中定义类? [英] What colon ( : ) means defining a class in c#?
问题描述
在C#中定义一个类有哪些呢:
表示
In c# defining a class what does :
means?
为例,在ASP.NET MVC应用程序的这个非常基本的控制器:
As example, in this very basic controller of an ASP.NET MVC application:
namespace App.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
在第三行,什么是:控制器
表示
推荐答案
在此情况下,它意味着的HomeController
继承了控制器
类。
In this case it means that the HomeController
inherits the Controller
class.
您可以阅读关于继承这里更多的细节,但简单地说 - 继承意味着一切一个控制器
是一个的HomeController
是也。 A 的HomeController
是一个更细粒度控制器
类。
You can read more details about inheritance here, but simply put - inheritance means that everything a Controller
is, a HomeController
is also. A HomeController
is a more finely grained Controller
class.
它也可用于实施接口<一href=\"http://msdn.microsoft.com/en-us/library/ms173156.aspx\">http://msdn.microsoft.com/en-us/library/ms173156.aspx
这篇关于什么冒号(:))是指在C#中定义类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!