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

Martin Hinks mhinks at gmail.com
Wed May 24 10:28:22 EDT 2006


Yeah, my replies were incorrect, I thought I'd read somewhere that was
the way to do it... sadly not.

Sorry about that.

On 5/24/06, Ympostor <ympostor at clix.pt> wrote:
> 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
>
> --
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>


-- 
Martin Hinks
http://www.m-s-d.net



More information about the Mono-devel-list mailing list