开发者

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

开发者 https://www.devze.com 2023-03-30 15:09 出处:网络
I have C# class definition MyViewModelClass: INotifyPropertyChanged, MyAbs开发者_开发百科tractBaseForVMClass

I have C# class definition

MyViewModelClass: INotifyPropertyChanged, MyAbs开发者_开发百科tractBaseForVMClass

It won't compile. Gives and error at the start of MyAbstractBaseForVMClass literal:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消