今天总算闲下来 看看王涛的你必须知道的.net了 在OO大原则这一章节 看得尤为仔细 因为刚刚看完 程杰的那本小菜跟大鸟的书啊 在面向接口的时候 发现一个问题
class Computeruse : IComputerLearn, IComputerToFun, IComputerWork
{
public Computeruse()
{
Console.WriteLine("这个电脑我在用 别管我干嘛!!");
}
}
interface IComputerLearn
{
void ToLearn();
}
interface IComputerWork
{
void ToWork();
}
interface IComputerToFun
{
void ToFun();
}
{
public Computeruse()
{
Console.WriteLine("这个电脑我在用 别管我干嘛!!");
}
}
interface IComputerLearn
{
void ToLearn();
}
interface IComputerWork
{
void ToWork();
}
interface IComputerToFun
{
void ToFun();
}
我的一个类同时继承三个接口 但是我如何让这三个接口实现呢 就算我实例化一个ComputerUse对象 还是没有找到三个接口的实现方法 而且在类里面 也不能重载三个接口的方法 接口不是用来限制行为的吗? 怪事!还望高手能够赐教啊