473,473 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

"does not implement interface member" Error - Known bug ?

I have an interface class with maybe eight functions, defined in one
workspace and am defining a class in a second workspace that derives from
this interface.

Unfortunately only 7 of the 8 functions in my derived class compile whilst
just one of them refuses to be recognised, leading to an error message
"...does not implement interface member...".

Try as I might, I can't fix the error. I have cut and paste names so can
rule out simple type errors.

If I cut and paste the interface class into the second workspace (just
renaming interface so it doesn't clash) then behold, now it works !

The only thing that differentiates the one function that fails from the
other 7 is that one of the parameters is an enum defined in the first
workspace.

Have I missed something obvious ? Or is this a bug in VS2005 ?

I can get it to compile by fully qualifying everything:-

Original :-

public bool MyFunc( EnumedType x, int y )

Modified. :-

bool firstnamespace.IMyInterface.MyFunc( firstnamespace.EnumedType x, int y)

Note however that I've had to remove the "public" from the modified form :-(
Totally confused (yes, I have the "using firstnamespace;" at teh top of teh
file and I have added the first namespace to teh project's references.

TTFN,
Jon

Aug 4 '08 #1
3 15739
Jon E <Jo**@discussions.microsoft.comwrote:

<snip>
Original :-

public bool MyFunc( EnumedType x, int y )

Modified. :-

bool firstnamespace.IMyInterface.MyFunc( firstnamespace.EnumedType x, int y)

Note however that I've had to remove the "public" from the modified form :-(
Totally confused (yes, I have the "using firstnamespace;" at teh top of teh
file and I have added the first namespace to teh project's references.
The reason you have to remove the public there is that it's now
explicitly implementing that part of the interface.

However, it's not clear why it wasn't working beforehand. Can you post
a short but complete example (in two projects still) which shows the
problem?

--
Jon Skeet - <sk***@pobox.com>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Aug 4 '08 #2
On Aug 4, 9:50*am, Jon E <J...@discussions.microsoft.comwrote:
I have an interface class with maybe eight functions, defined in one
workspace and am defining a class in a second workspace that derives from
this interface.
a class IMPLEMENT an interface, does not derives from it.

Have I missed something obvious ? Or is this a bug in VS2005 ?
not sure of where your error is, I would guess (and this is only a
guess) that some of the parameters types have a name conflict with
some other types defined in your second namespace.

What I usually do is using the autogeneration feature of the IDE,
when you implement an interface you can autogenerate the members ( by
click shift+alt+F10)
Aug 4 '08 #3
I agree with this advice.

I tried to reproduce this and could not. Here is the method I went
about that:

1) Create a new project workspace - project1
2) Create a new project within the workspace - project2
3) Add an interface file to project2
4) Add an enum to the interface file inside the namespace
5) Make the interface have several functions, one of which takes the
enum
6) Make project1 have a reference to project2 and add the using
namespace call
7) In project1, make a class which implements the interface
8) Right-click the interface name and click "Implement Interface"
9) Finally, compile it.

Did I miss something important?

Kyle

On Aug 4, 10:18*am, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac...@gmail.comwrote:
On Aug 4, 9:50*am, Jon E <J...@discussions.microsoft.comwrote:
I have an interface class with maybe eight functions, defined in one
workspace and am defining a class in a second workspace that derives from
this interface.

a class IMPLEMENT an interface, does not derives from it.
Have I missed something obvious ? Or is this a bug in VS2005 ?

*not sure of where your error is, I would guess (and this is only a
guess) that some of the parameters types have a name conflict with
some other types defined in *your second namespace.

*What I usually do is using the autogeneration feature of the IDE,
when you implement an interface you can autogenerate the members ( by
click shift+alt+F10)
Aug 6 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: seesaw | last post by:
When define an interface of all pure virtual functions, will the destructor of it will automatically virtual, or it has to be declared as virtual? Should it be declared as "virtual" when defining...
2
by: Bill Zhao | last post by:
Dear all, Sorry for i did not paste original propreity codes See below the fake codes for what I cannot understand. =============================================== lass A { public: virtual...
4
by: Luke Wu | last post by:
I am just wondering what the following terms usually mean: 1) "Standard C" 2) "K&R C" 3) "ANSI C" I am pretty sure "ANSI C" usually refers to the C89 standard, but what
1
by: n_o_s_p_a__m | last post by:
My web service has a webmethod whose return type is declared as an interface type, for example: public IBusinessProcess GetBusinessProcess() {} which generates the lovely error: Cannot...
5
by: charliewest | last post by:
I've implemented the USING statement to ensure that my newly created sql connection closes when my method is finished using it. The USING statement is wrapped in try/catch error handling statement....
3
by: Dave | last post by:
Greetings All, I have never seen this error before, and after an extensive search of Groups, I cannot find a satisfactory answer to my basic question. What exactly does "is not a member of...
39
by: utab | last post by:
Dear all, Is there a clear distinction how to decide which functions to be members of a class and which not How is your attitude (Your general way from your experiences ...) "If the...
28
by: Jess | last post by:
Hello, It is said that if I implement a "swap" member function, then it should never throw any exception. However, if I implement "swap" non- member function, then the restriction doesn't...
6
by: Smithers | last post by:
Just looking to compile a list of "all the ways to implement events". I'm NOT looking to get into the merits or mechanics of each in this thread... just want to identify them all - good, bad, and...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.