接口如何使用? 同事写了个接口给我,但我没用过不知道怎么用。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class myClass : IXXX{}; 接口不能直接使用,它没提供具体的实现,只定义了一些方法或者属性。你同事估计是让你写一个类实现这个接口。方法在1楼class 你写的类 : 你同事的接口{ // .....实现} interface Imyinterface { void SayHello(string str); } class A : Imyinterface { #region Imyinterface 成员 public void SayHello(string str) { MessageBox.Show("Class A SayHello Method:"+str); } #endregion } class B : Imyinterface { #region Imyinterface 成员 public void SayHello(string str) { MessageBox.Show("Class B SayHello Method:" + str); } #endregion } public interface ISend{void Add();}public myClass:ISend{public void Add(){//你的代码}} Resources中的问题 【100分】这样的功不知能不能实现 WebBrowser的问题,超郁闷,麻烦大家来帮帮忙 如何通过变量名获取类的实例,如:我输入A,则实例化A,输入B,则实例化B类 在线等待----高手请进! 如何写一通用函数让窗体只打开一次 怎样在datagrid中把显示的对应行删除~~ ibatisnet+access sql 语句中有空格 如何写VPN连接字符串 listbox奇怪应用 调试网站 文本框默认值
{
};
你同事估计是让你写一个类实现这个接口。方法在1楼
class 你写的类 : 你同事的接口{ // .....实现}
interface Imyinterface
{
void SayHello(string str);
} class A : Imyinterface
{
#region Imyinterface 成员 public void SayHello(string str)
{
MessageBox.Show("Class A SayHello Method:"+str);
} #endregion
}
class B : Imyinterface
{
#region Imyinterface 成员 public void SayHello(string str)
{
MessageBox.Show("Class B SayHello Method:" + str);
} #endregion
}
public interface ISend
{
void Add();
}public myClass:ISend
{
public void Add()
{
//你的代码
}
}