Can one class inherit from another class, it implemented the interface at the same time?

somthing like

public partial class RegistrationForm : IRegistrationForm, System.Web.UI.UserControl 

but this example does not work.

+4
source share
2 answers

Yes, but you do it like this:

 public partial class RegistrationForm : System.Web.UI.UserControl, IRegistrationForm 

C # does not support multiple inheritance, so first you put a class that you inherit, and then a comma, and then a list of interfaces that it implements with a comma.

+11
source

Absolutely, a class can inherit from one base class and at the same time apply any number of interfaces.

Your example does not work, because one base class must be specified first, before all interfaces ...

+5
source

All Articles