[Mono-dev] Re: Constructor implementation obligation via interface?

Ympostor ympostor at clix.pt
Wed May 24 10:23:23 EDT 2006


Martin Hinks escribió:
> You can't force a constructor via an interface...
> 
> Write an abstract class with the constructor definition that you want,
> specify that the interface inherits the abstract class

It seems an interface cannot inherit from a class. Example:

     public abstract class ExampleWithEmptyConstructor
     {
         public ExampleWithEmptyConstructor()
         {
         }
     }

     public interface IExample : ExampleWithEmptyConstructor
     {

     }

This returns a compilation error: Error	1	Type 
'ExampleWithEmptyConstructor' in interface list is not an interface.

Regards

-- 




More information about the Mono-devel-list mailing list