473,387 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

C++/CLI Interfaces

Two questions:

1) I have an assembly that defines the interface for a component. The
assembly only contains the interface (as per component development guidance),
a different assembly contains the C++ classes that implement the interface.
When I write a VB app that references both strong named assemblies, the
VS2005 object browser and intellisense tells me the namespace (shared by both
interface and implementation class) identifier is ambiguous because the
interface is showing up in both assemblies. What am I doing wrong?

2) I have a few static events on an C++ implementation class found in a
strong named assembly. All works fine when a simple VB app references the
assembly, the VB app can register for and receive the events but has to
reference the C++ class in the assembly. If I try to add the events to the
interface the C++ class implements, I get compile errors that indicate you
cannot have static events on an interface. If I get rid of the static
modifier, all heck breaks loose. Any suggestions (note the events pass
arguments)?

Thanks
Mar 8 '07 #1
2 2095
NEW2.NET wrote:
1) I have an assembly that defines the interface for a component. The
assembly only contains the interface (as per component development guidance),
a different assembly contains the C++ classes that implement the interface.
When I write a VB app that references both strong named assemblies, the
VS2005 object browser and intellisense tells me the namespace (shared by both
interface and implementation class) identifier is ambiguous because the
interface is showing up in both assemblies. What am I doing wrong?
Are you sure the C++ implementation is referencing the assembly instead
of including it? You have to reference it with #using, not copy-pasting
it with #include. If you use #include, it will certainly be a completely
separate class with the same name, thus causing duplicate identifiers.

I can't comment on #2, never done that before.

Tom
Mar 8 '07 #2
2) I have a few static events on an C++ implementation class found in a
strong named assembly. All works fine when a simple VB app references the
assembly, the VB app can register for and receive the events but has to
reference the C++ class in the assembly. If I try to add the events to
the
interface the C++ class implements, I get compile errors that indicate you
cannot have static events on an interface. If I get rid of the static
modifier, all heck breaks loose. Any suggestions (note the events pass
arguments)?
While an interface can have static members in .Net, they aren't in any way
connected to classes implementing that interface. Interfaces define a
contract on objects (instances) that implement the interface, not on
classes.
>
Thanks

Mar 8 '07 #3

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

Similar topics

1
by: baylor | last post by:
In C#, an interface cannot mark any method as static. i'm told the ILASM supports it but i've never tested that Two questions. First, why? OK, i've heard the reason about interfaces being...
30
by: Frank Rizzo | last post by:
We are having one of those religious debates at work: Interfaces vs Classes. My take is that Classes give you more flexibility. You can enforce a contract on the descendant classes by marking...
8
by: John | last post by:
What is the purpose / benefit of using an interface statement? It doesn't seem like anything more than a different way to make a class... (except you can't define any procedures in an interface...
9
by: Sean Kirkpatrick | last post by:
To my eye, there doesn't seem to be a whole lot of difference between the two of them from a functional point of view. Can someone give me a good explanation of why one vs the other? Sean
18
by: _dee | last post by:
Question about best use of interfaces: Say there's a 'Master' class that needs to implement a few interfaces: class Master : I1, I2, I3 { } The actual code already exists in smaller...
22
by: RSH | last post by:
Hi, I have been reading on interfaces working on samples I've run across on the web. For the life of me I cannot seem to grasp them. It appears to me that interfaces are simply blueprints to...
18
by: Tony | last post by:
class Interface { public: virtual void DoItNow()=0; }; class A: public Interface { public: void DoItNow(); // satisfies interface explicitly
5
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I am actually a VB.Net guy, but I have worked somewhat with C++ and C#. I just want to ask about the relationship between Abstract Classes and Interfaces. My first question is if...
10
by: hyperboreean | last post by:
Hi, Probably it has been asked before, but I'll still ask. Why doesn't python provide interfaces trough its standard library? Or it was ever proposed to be included in the language? Zope's...
23
by: A.Gallus | last post by:
If I declare a function pure virtual: class A { virtual void myfunc() = 0; } and I derive a class from A: class B : public A
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.