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

accessing operator overloaded class defined in c#

P: n/a
A quick question if I may (this relates to .NET1.1 by the way):

If I have a C# class defined in my project that does operator overloading,
can I use this in my VB code?

For example, I have a c# class called for the sake of argument dummyclass
which has the + operator overloaded.

In C# I can do dummyclass temp = someInstanceofDummyClass1 +
someInstanceofDummyClass1;

When I try to access this in my VB code it tells me that the Operator '+'
has not been defined for types dummyclass.

Am I doing something wrong, or is this something inherent in 1.1?

Cheers!
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Armond VanHeusen" <av*@klok.com> schrieb:
If I have a C# class defined in my project that does operator overloading,
can I use this in my VB code?
Basically yes, but you cannot use the operators directly.
For example, I have a c# class called for the sake of argument dummyclass
which has the + operator overloaded.

In C# I can do dummyclass temp = someInstanceofDummyClass1 +
someInstanceofDummyClass1;

When I try to access this in my VB code it tells me that the Operator '+'
has not been defined for types dummyclass.


Operators are methods with special names.

VB.NET 2002/2003:

\\\
c = wrapInt32.op_Addition(a, b)
///

VB 2005 will support operator overloading, so the code you posted will work
then without using 'op_Addition'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2

P: n/a
thanks for that! And here I thought i was going crazy!!!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl...
"Armond VanHeusen" <av*@klok.com> schrieb:
If I have a C# class defined in my project that does operator overloading, can I use this in my VB code?
Basically yes, but you cannot use the operators directly.
For example, I have a c# class called for the sake of argument dummyclass which has the + operator overloaded.

In C# I can do dummyclass temp = someInstanceofDummyClass1 +
someInstanceofDummyClass1;

When I try to access this in my VB code it tells me that the Operator '+' has not been defined for types dummyclass.


Operators are methods with special names.

VB.NET 2002/2003:

\\\
c = wrapInt32.op_Addition(a, b)
///

VB 2005 will support operator overloading, so the code you posted will

work then without using 'op_Addition'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.