About Interface

时间:2015-12-03 13:31:54   收藏:0   阅读:291

?

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");

}

}

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!