首页 > 其他 > 详细

About Interface

时间:2015-12-03 13:31:54      阅读:291      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!