472,958 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

"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 15712
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.