473,385 Members | 1,341 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,385 software developers and data experts.

Overriding operators

Hello,

Is there anyway to override operators (+,- etc) in VB .NET or is this only
possible through C#?

I want to create a class that can override these operators.

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.headfirst.co.uk www.callofcthulhu.com
-
Nov 20 '05 #1
9 1969
Hi Simon,

Simple answer, planned in next version of VB.net, so now only C versions, (I
do not know about J#)

I hope this helps?

Cor
Is there anyway to override operators (+,- etc) in VB .NET or is this only
possible through C#?

Nov 20 '05 #2
Thanks for your reply,

Trying to get around the System.UInt32 not having the +/- operators. Its a
bit tedious having to do a number of conversions to perform an addition.
Trying to work out a way of making to code a bit more elegant but will
convert to Whidbey without many changes etc...

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.headfirst.co.uk www.callofcthulhu.com
-
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi Simon,

Simple answer, planned in next version of VB.net, so now only C versions,
(I
do not know about J#)

I hope this helps?

Cor
Is there anyway to override operators (+,- etc) in VB .NET or is this
only
possible through C#?


Nov 20 '05 #3
* "Simon Jefferies" <si****@headfirst.co.uk> scripsit:
Trying to get around the System.UInt32 not having the +/- operators.


These operators will be available in VS.NET 2005.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
* "Simon Jefferies" <si****@headfirst.co.uk> scripsit:
Is there anyway to override operators (+,- etc) in VB .NET or is this only
possible through C#?


Overriding? Overloading will be possible in VB.NET Whidbey, 2005.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5
>
These operators will be available in VS.NET 2005.

Hi Herfried,

Are you sure that is not the next version of VB.net?

Cor
Nov 20 '05 #6
Hi Herfried,

See my reply on your other message in this thread?

Cor
Nov 20 '05 #7
* "Cor Ligthert" <no**********@planet.nl> scripsit:
See my reply on your other message in this thread?


Yep.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #8
Simon,
Have you considered using C# for all your UInt32 work, at least until
Whidbey ships. Then calling the C# class library from VB.NET? In other words
encapsulate all the unsigned logic in C# classes...

Alternatively depending on how I am actually using the UInt32, I will simply
use an Integer (which is fully supported) any place I would have used a
UInt32...

Hope this helps
Jay

"Simon Jefferies" <si****@headfirst.co.uk> wrote in message
news:u6**************@TK2MSFTNGP11.phx.gbl...
Thanks for your reply,

Trying to get around the System.UInt32 not having the +/- operators. Its a
bit tedious having to do a number of conversions to perform an addition.
Trying to work out a way of making to code a bit more elegant but will
convert to Whidbey without many changes etc...

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.headfirst.co.uk www.callofcthulhu.com
-
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi Simon,

Simple answer, planned in next version of VB.net, so now only C versions, (I
do not know about J#)

I hope this helps?

Cor
Is there anyway to override operators (+,- etc) in VB .NET or is this
only
possible through C#?



Nov 20 '05 #9
Many thanks for your help,

This is the approach I have taken, but its reassuring that you have
mentioned it too.

My thoughts were that my UInt32 class etc can then easily be replaced when I
upgrade to Whidbey.

Best Wishes
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.headfirst.co.uk www.callofcthulhu.com
-
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:e6*************@TK2MSFTNGP10.phx.gbl...
Simon,
Have you considered using C# for all your UInt32 work, at least until
Whidbey ships. Then calling the C# class library from VB.NET? In other
words
encapsulate all the unsigned logic in C# classes...

Alternatively depending on how I am actually using the UInt32, I will
simply
use an Integer (which is fully supported) any place I would have used a
UInt32...

Hope this helps
Jay

"Simon Jefferies" <si****@headfirst.co.uk> wrote in message
news:u6**************@TK2MSFTNGP11.phx.gbl...
Thanks for your reply,

Trying to get around the System.UInt32 not having the +/- operators. Its
a
bit tedious having to do a number of conversions to perform an addition.
Trying to work out a way of making to code a bit more elegant but will
convert to Whidbey without many changes etc...

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
www.headfirst.co.uk www.callofcthulhu.com
-
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> Hi Simon,
>
> Simple answer, planned in next version of VB.net, so now only C versions, > (I
> do not know about J#)
>
> I hope this helps?
>
> Cor
>> Is there anyway to override operators (+,- etc) in VB .NET or is this
>> only
>> possible through C#?
>
>



Nov 20 '05 #10

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

Similar topics

0
by: Nicodemus | last post by:
Hi all, I found a surprising behavior regarding new-style classes operator lookup. It seems that for operators, the instance methods are ignored. Observe: >>> class C: .... def foo(self):...
3
by: Andrew Durdin | last post by:
In Python, you can override the behaviour of most operators for a class, by defining __add__, __gt__, and the other special object methods. I noticed that, although there are special methods for...
1
by: Andrew Durdin | last post by:
On Fri, 20 Aug 2004 23:28:20 -0700, Robert Brewer <fumanchu@amor.org> wrote: > > The first barrier is that 'or' and 'and' get compiled down to jump > codes, as opposed to operations: >...
8
by: Edward Diener | last post by:
Is it possible for a derived class to override a property and/or event of its base class ?
3
by: Cheng Mo | last post by:
When overriding operator new & delte of one class, the method is implicitly declared as static. However, overriding operator new & delete of template cannot be static.The compiler says cannot...
3
by: Gonçalo Rodrigues | last post by:
Hi all, I have a base class, call it Object, that implements operators new and delete. Now suppose there is also a class, call it Derived, deriving from Object. It has the feature that *all*...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
9
by: groleo | last post by:
Hi list. Simple question: is it possible to override the global new/delete operators, without using malloc/free? I mean something in the ideea of the code below, which doesnt work cause of...
3
by: Kenneth Baltrinic | last post by:
When one overrides the Equals() method of an object, one is supposed to override GetHashCode() as well and this makes good sense. But I have seen lots of people who do this and do not override the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.