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

Home Posts Topics Members FAQ

Operator Overload - Whidbey

Hello friends...
Inside my class how do to use explicit using Overloaded operator or use
default ?
Ex:
Dim x as Integer = A + B ' Use default + operator

Dim OV as integer = X + Z ' I will need use Overloaded + Operator ???
Thanks and sorry my bad English.
Regards
Genival Carvalho
Nov 20 '05 #1
7 1563
Hi Genival,

Why did you put Whidbey in the title of your question, I wonder?

For the answer to your question lies in that word - Wait for Whidbey.

That's the sad fact. Operator overloading is on its way but it's not here
yet.

Regards,
Fergus
Nov 20 '05 #2
Genival,
Are you asking how do you do define Operator Overloading in Whidbey? Or how
do you use an overloaded Operator in Whidbey?

It might help if you tell us what types A, B, & Z are.

As Fergus pointed out, you will need to wait for Whidbey to do Operator
Overloading in VB.NET.

For details of how operator overloading will probably work in Whidbey see:

http://blogs.gotdotnet.com/cambecc/p...1-127195cceeab

Note seeing as Whidbey is still a beta, the actual specifics may change.

Hope this helps
Jay

"Genival Carvalho" <ge*****@hotmail.com> wrote in message
news:eg*************@TK2MSFTNGP11.phx.gbl...
Hello friends...
Inside my class how do to use explicit using Overloaded operator or use
default ?
Ex:
Dim x as Integer = A + B ' Use default + operator

Dim OV as integer = X + Z ' I will need use Overloaded + Operator ???
Thanks and sorry my bad English.
Regards
Genival Carvalho

Nov 20 '05 #3
TankZ Guys...
I am waiting... but i will know ho do Operator overload will work.

Regards
Genival Carvalho.
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:eq**************@TK2MSFTNGP11.phx.gbl...
Genival,
Are you asking how do you do define Operator Overloading in Whidbey? Or how do you use an overloaded Operator in Whidbey?

It might help if you tell us what types A, B, & Z are.

As Fergus pointed out, you will need to wait for Whidbey to do Operator
Overloading in VB.NET.

For details of how operator overloading will probably work in Whidbey see:

http://blogs.gotdotnet.com/cambecc/p...1-127195cceeab
Note seeing as Whidbey is still a beta, the actual specifics may change.

Hope this helps
Jay

"Genival Carvalho" <ge*****@hotmail.com> wrote in message
news:eg*************@TK2MSFTNGP11.phx.gbl...
Hello friends...
Inside my class how do to use explicit using Overloaded operator or use
default ?
Ex:
Dim x as Integer = A + B ' Use default + operator

Dim OV as integer = X + Z ' I will need use Overloaded + Operator ???

Thanks and sorry my bad English.
Regards
Genival Carvalho


Nov 20 '05 #4
* "Genival Carvalho" <ge*****@hotmail.com> scripsit:
Inside my class how do to use explicit using Overloaded operator or use
default ?
You want to overload the operator for the Integer type?!
Ex:
Dim x as Integer = A + B ' Use default + operator

Dim OV as integer = X + Z ' I will need use Overloaded + Operator ???


What's the type of 'Z'?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
The question is:
How do to instruct compiler to use Overloaded Operator version or use
default operator ?

Ex: Dim x as integer = A + B ' I need use overloaded version how to intruct
.....

Ex2: Dim P as integer = C + D ' At this point i need use default + operator

Thank you.


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
* "Genival Carvalho" <ge*****@hotmail.com> scripsit:
Inside my class how do to use explicit using Overloaded operator or use
default ?
You want to overload the operator for the Integer type?!
Ex:
Dim x as Integer = A + B ' Use default + operator

Dim OV as integer = X + Z ' I will need use Overloaded + Operator

???
What's the type of 'Z'?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Nov 20 '05 #6
* "Genival Carvalho" <ge*****@hotmail.com> scripsit:
How do to instruct compiler to use Overloaded Operator version or use
default operator ?

Ex: Dim x as integer = A + B ' I need use overloaded version how to intruct
....

Ex2: Dim P as integer = C + D ' At this point i need use default + operator


If you are using whidbey, why don't/didn't you post to the Whidbey alpha
groups? There will only be very few people with VB.NET Whidbey
experiences.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

Dilbert's words of wisdom #18: Never argue with an idiot. They drag you down
to their level then beat you with experience.
Nov 20 '05 #7
Genival,
How do to instruct compiler to use Overloaded Operator version or use
default operator ? Assuming that A, B, C, and D are integers, you do not instruct the compiler
to use an overloaded operator.

To define an overloaded operator the function needs to be in the class or
structure that the operator pertains to, at least one of the parameters need
to be of the class or structure that the overloaded operator is in.

So you cannot overload the + operator for integers, you can only overload
the operator for your own classes & structures

See the link I gave earlier.

Hope this helps
Jay

"Genival Carvalho" <ge*****@hotmail.com> wrote in message
news:O6**************@TK2MSFTNGP12.phx.gbl... The question is:
How do to instruct compiler to use Overloaded Operator version or use
default operator ?

Ex: Dim x as integer = A + B ' I need use overloaded version how to intruct ....

Ex2: Dim P as integer = C + D ' At this point i need use default + operator
Thank you.


"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
* "Genival Carvalho" <ge*****@hotmail.com> scripsit:
Inside my class how do to use explicit using Overloaded operator or use default ?


You want to overload the operator for the Integer type?!
Ex:
Dim x as Integer = A + B ' Use default + operator

Dim OV as integer = X + Z ' I will need use Overloaded + Operator

???

What's the type of 'Z'?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>


Nov 20 '05 #8

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

Similar topics

5
by: bsaucer | last post by:
I am creating a class with operator overloads. It makes references to another class I've created, but do not wish to modify. I try to overload an operator having arguments having the other class...
5
by: Jason | last post by:
Hello. I am trying to learn how operator overloading works so I wrote a simple class to help me practice. I understand the basic opertoar overload like + - / *, but when I try to overload more...
4
by: Chiller | last post by:
Ok, thanks to some good assistance/advice from people in this group I've been able to further develop my Distance class. Since previous posts I've refined my code to accept the unit measurement...
7
by: Sean | last post by:
Can someone help me see why the following "operator=" overloading doesn't work under g++? and the error message is copied here. I see no reason the compiler complain this. Thanks, $ g++...
17
by: Chris | last post by:
To me, this seems rather redundant. The compiler requires that if you overload the == operator, you must also overload the != operator. All I do for the != operator is something like this: ...
13
by: Jon Cosby | last post by:
VB .Net does support operator overloading, doesn't it? It seems like this should overload binary addition, but VB doesn't recognize "Operator" Public Shared Operator +(ByVal c1 as cnum, ByVal c2...
9
by: Tony | last post by:
I have an operator== overload that compares two items and returns a new class as the result of the comparison (instead of the normal bool) I then get an ambiguous operater compile error when I...
5
by: raylopez99 | last post by:
I need an example of a managed overloaded assignment operator for a reference class, so I can equate two classes A1 and A2, say called ARefClass, in this manner: A1=A2;. For some strange reason...
3
by: y-man | last post by:
Hi, I am trying to get an overloaded operator to work inside the class it works on. The situation is something like this: main.cc: #include "object.hh" #include "somefile.hh" object obj,...
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: 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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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.