By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,569 Members | 1,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,569 IT Pros & Developers. It's quick & easy.

Implementing Interfaces in C#

P: n/a
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



Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" <re******@NOSPAMTelus.net> wrote in message news:OK**************@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


Nov 15 '05 #2

P: n/a
Michael
I always get an error if I don't implement an Interface method.

With Regards

Deepa
[I code, therefore I am
----- Michael Culley wrote: ----

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

void DoSomething()

public class Class1 : AB

public Class1(


-
Michael Culle
"Frank J. Reashore" <re******@NOSPAMTelus.net> wrote in message news:OK**************@TK2MSFTNGP09.phx.gbl..
Hello Everyone
I am implementing a simple interface in C# using Visual Studio .net and wa

quite surprised to discover that the C# compiler does NOT complain if
method on the interface is not implemented
VB.net on the other hand generates a compile error if a method is no

implemented. This helps in ensuring that all interface methods ar
implemented
The fact that C# does not provide such compile errors makes implementing an

interface in C# more labor intensive than in VB.net. You have to use th
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. Reashor
Vancouver, Canad
>>>

Nov 15 '05 #3

P: n/a
Hi Frank, It's would be best to post the source (pref a simplified version)
that you believe to be compiling without errors. As others have noted you
should see compile errors if an interface method is not implemented.

Richard

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Frank J. Reashore" <re******@NOSPAMTelus.net> wrote in message
news:OK**************@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


Nov 15 '05 #4

P: n/a
There have been times when I'm pulling my hair out WISHING C# wouldn't give
me an error when implementing an interface, but no such luck.

Visual C# in the Visual Studio 2003 IDE give me a fatal error if I attempt
to compile an app that does not have all methods of an inherited interface
defined.

Please post an example of what you are seeing. Perhaps we can help you to
find the issue.

--- Nick

"Frank J. Reashore" <re******@NOSPAMTelus.net> wrote in message
news:OK**************@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


Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.