从抽象类继承和实现,同时接口 [英] Inherit from an abstract class and realize an interface at the same time

查看:430
本文介绍了从抽象类继承和实现,同时接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有C#类定义



  MyViewModelClass:INotifyPropertyChanged的,MyAbstractBaseForVMClass 

这将无法编译。给错在MyAbstractBaseForVMClass字面的启动:



接口定义有望



我能不知道的接口,从抽象类,同时继承?


解决方案

没有也可以。 。MyAbstractBaseForVMClass,INotifyPropertyChanged的

  MyViewModelClass > 

接口总是放学后。


I have C# class definition

MyViewModelClass: INotifyPropertyChanged, MyAbstractBaseForVMClass

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.

这篇关于从抽象类继承和实现,同时接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆