码迷,mamicode.com
首页 > Windows程序 > 详细

C# to IL Reference and Value Types(引用类型和值类型)

时间:2017-04-12 11:07:32      阅读:270      评论:0      收藏:0      [点我收藏+]

标签:images   cannot   contract   curl   creation   分享   com   img   sse   

技术分享

An interface is a reference type, in spite of the fact that it has no code at all. Thus, we
cannot instantiate an interface. We can use it as a construct for the creation of new types.
An interface defines a contract that is left to the class to implement.
An interface can have static fields. If an interface contains 10 abstract virtual functions,
then the class implementing from that interface has to supply the code for all 10 of them.
Thus, if a class does not provide all the function implementations, then we cannot use the
class. In such a scenario, a class derived from it must provide the implementation.
The interface keyword in C# is a class, which the documentation describes as a semantic
attribute.

技术分享

We are not allowed to place any code in an interface. An interface consists only of the
function prototype, followed by a pair of curly braces {}

技术分享

技术分享

vijay1 is a function created in the interface yyy. As this is not permitted, the il assembler
has the domino effect as shown above


C# to IL Reference and Value Types(引用类型和值类型)

标签:images   cannot   contract   curl   creation   分享   com   img   sse   

原文地址:http://www.cnblogs.com/revoid/p/6698091.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!