请问下面代码为什么通不过编译呢?
public interface interA
{ } public interface interB
{
string MethodA(interA str);
} public class classA : interA
{ } public class classB : interB
{
public string MethodA(classA str)
{
return "";
}
}
错误提示:错误 1 “WebApplication2.classB”不实现接口成员“WebApplication2.interB.MethodA(WebApplication2.interA)” E:\WebApplication2\WebApplication2\Default.aspx.cs 37 18 WebApplication2
public interface interA
{ } public interface interB
{
string MethodA(interA str);
} public class classA : interA
{ } public class classB : interB
{
public string MethodA(classA str)
{
return "";
}
}
错误提示:错误 1 “WebApplication2.classB”不实现接口成员“WebApplication2.interB.MethodA(WebApplication2.interA)” E:\WebApplication2\WebApplication2\Default.aspx.cs 37 18 WebApplication2
解决方案 »
- 将一个.net工程放到服务器上连接数据库的问题。
- 验证邮箱。。。。
- 请问C#窗体属性中有没有属性来来根据分辨率来调整窗体和其中控件大小位置的?
- 新手问个问题哦!!!!!!!!!!!请大家帮忙。
- 盼 高 手 指 点
- 急~~再线等~~~问题搞定马上散分··本地磁盘问题
- 字符串的语法错误 在查询表达式 '1=1 and NType='tzgg order by NOrderNum asc, NAddTime desc' 中
- 请教
- checkedListBox问题。
- 欢迎访问由!班门斧,lkal4587, yarshray!担任斑竹的!红点科技互动论坛 !!!
- 在Java区看到一个比较有意思的题目,转过来大家讨论一下
- [C#]如何在一个函数里调用一个控件的事件过程
{
public string MethodA(interA str)
{
return "";
}
}实例化接口方法的时候不支持协变,但在调用方法的时候,可以传入classA的实例
{ } public interface interB<T> where T : interA
{
string MethodA(T str);
} public class classA : interA
{ } public class classB : interB<classA>
{
public string MethodA(classA str)
{
return "";
}
}