码迷,mamicode.com
首页 > 其他好文 > 详细

About Interface

时间:2015-12-03 13:35:00      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:

?

http://www.codeproject.com/Articles/18743/Interfaces-in-C-For-Beginners

?

Interface can‘t have things like int x;

All interface defined function must be realized with public decorator.

?

Here is an example for object array

class Demo : abc

{

public static void Main()

{

abc [] refabc = {new Demo(), new Sample()} ;

for (int i = 0; i<= 1; i++)

refabc[i].xyz();

}

?

public void xyz()

{

System.Console.WriteLine("In Demo :: xyz");

}

}

?

interface abc

{

void xyz();

}

?

class Sample : abc

{

public void xyz()

{

System.Console.WriteLine("In Sample :: xyz");

}

}

About Interface

标签:

原文地址:http://www.cnblogs.com/jiceberg420/p/5015531.html

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