| 发表于:2007-03-07 13:56:11 楼主 |
interface itest { string test { get; set; } } interface itest2 { string test(); } class ctest : itest,itest2 { public string _test; public string test { get{ return _test; } set { _test = value; } } public string test() { console.writeline( "this is a test method "); } } itest和itest2接口分别有一个名为test的属性和方法,ctest类从这个接口继承,但是只能实现其中的一个,否则编译会报“同名”。如果只实现一个编译会报“test未实现”。 如果再定义一个接口itest3 interface itest3 : itest, itest2 {} 这个接口定义是没有问题的,但是总不能只定义接口不实现吧。请教各位如何实现从itest和itest2中继承,并实现呢。没有分了,我想各位来这里是交流的吧,不是为了赚分吧。发扬一下共享精神吧。 |
|
|
|
|