Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 继承抽象类,同时实现接口_C#_Multiple Inheritance - Fatal编程技术网

C# 继承抽象类,同时实现接口

C# 继承抽象类,同时实现接口,c#,multiple-inheritance,C#,Multiple Inheritance,我有C#类定义 MyViewModelClass: INotifyPropertyChanged, MyAbstractBaseForVMClass 它不会编译。在MyAbstractBaseForVMClass文本的开头给出并出错: 需要接口定义 我能不能实现一个接口,同时从一个抽象类继承?不行。只要把它们倒过来 MyViewModelClass: MyAbstractBaseForVMClass, INotifyPropertyChanged 接口总是在课后提供。谢谢。你知道这个限制的逻

我有C#类定义

MyViewModelClass: INotifyPropertyChanged, MyAbstractBaseForVMClass
它不会编译。在MyAbstractBaseForVMClass文本的开头给出并出错:

需要接口定义


我能不能实现一个接口,同时从一个抽象类继承?

不行。只要把它们倒过来

MyViewModelClass: MyAbstractBaseForVMClass, INotifyPropertyChanged

接口总是在课后提供。

谢谢。你知道这个限制的逻辑解释吗?这里还有一个问题。我的猜测是,因为除了接口之外没有多重继承,第一个必须是基类或抽象类,然后是接口,接口当然可以不止一个。我不知道有这样的限制,因此无法通过名称找到这个问题。谢谢