Re: Implementing Interfaces in C#

From: Michael Culley (mculley_at_NOSPAMoptushome.com.au)
Date: 02/16/04


Date: Mon, 16 Feb 2004 11:29:26 +1100

It gives me an error, "Class1 does not implement interface member ABC.DoSomething()"

 public interface ABC
 {
  void DoSomething();
 }
 public class Class1 : ABC
 {
  public Class1()
  {
  }
 }

--
Michael Culley
"Frank J. Reashore" <reashore@NOSPAMTelus.net> wrote in message news:OKX6aNC9DHA.3404@TK2MSFTNGP09.phx.gbl...
> Hello Everyone,
>
> I am implementing a simple interface in C# using Visual Studio .net and was
> quite surprised to discover that the C# compiler does NOT complain if a
> method on the interface is not implemented.
>
> VB.net on the other hand generates a compile error if a method is not
> implemented. This helps in ensuring that all interface methods are
> implemented.
>
> The fact that C# does not provide such compile errors makes implementing and
> interface in C# more labor intensive than in VB.net. You have to use the
> object browser and check the function signature, etc.
>
> Is this normal behavior? Could I possibly be doing something wrong?
>
> Any help would be appreciated.
>
> Regards,
> Frank J. Reashore
>
> Vancouver, Canada
>
>
>
>
>
>
>


Relevant Pages

  • OLEAutomation Interop with object []
    ... There doesn't seem to be an obvious way to have an interface ... public class Class1: IMyInterface ... dim parm ... obj.Connect parm ...
    (microsoft.public.dotnet.framework.interop)
  • [OOP] attributes and interface both mandatory
    ... public MyAttribute: Attribute ... public interface MyInterface ... public class class1: MyInteface ... public class class1: MyInterface ...
    (microsoft.public.dotnet.framework)
  • Re: (inheritance) problem with generic
    ... > What puzzle me is that all 4 test return false! ... > Any idea why is that and how to find the IList interface from the type? ... Prev by Date: ...
    (microsoft.public.dotnet.framework)
  • (inheritance) problem with generic
    ... What puzzle me is that all 4 test return false! ... Any idea why is that and how to find the IList interface from the type? ... Prev by Date: ...
    (microsoft.public.dotnet.framework)
  • Re: Anonymous Inner class Creation
    ... > I got an unexpected token compile error. ... Why implement that interface? ... public runmethod for thread entry. ... public void run ...
    (comp.lang.java.programmer)