简体   繁体   English

从抽象类继承并同时实现接口

[英]Inherit from an abstract class and realize an interface at the same time

I have C# class definition 我有C#类定义

MyViewModelClass: INotifyPropertyChanged, MyAbstractBaseForVMClass

It won't compile. 它不会编译。 Gives and error at the start of MyAbstractBaseForVMClass literal: 在MyAbstractBaseForVMClass文字的开头给出和出错:

Interface definition is expected. 接口定义是预期的。

Can I not realize an interface, and inherit from an abstract class at the same time? 我可以不实现接口,同时从一个抽象类继承吗?

No you can. 不,你可以。 Just reverse them. 只需逆转它们。

MyViewModelClass: MyAbstractBaseForVMClass, INotifyPropertyChanged

Interfaces always come after classes. 接口总是在课后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM