|
-
Nov 6th, 2003, 12:53 AM
#1
Thread Starter
Lively Member
Overloaded Operators?
Hey, everybody.
I just "upgraded" to VB.NET, boy has it gotten better. My real background is VB6, but I also know C++ which has something that I really appreciate -- overloaded operators. So, can VB.NET overload operators?
Please say "yes"! Please say "yes"!
I don't want to search for it myself because I'll deny it if I don't "find" something about overloading operators. I want someone to say "No overloaded operators in VB.NET" for me to believe it.
**crossing fingers**
Call me Deuce.[vbcode]
If User.name = "Deucy" And User.status = "online" Then
Call Deuce()
End If
[/vbcode]
-
Nov 6th, 2003, 01:02 AM
#2
PowerPoster
I don't believe this is available in VB.Net (I haven't seen it yet, but I admit I haven't looked to hard....because of the statement below)
Good news is that C# does support operator overloading. Since you have some background in C++, you shouldn't have a hard time developing a C# app (assembly) at all, and it uses the same framework that VB.Net does. Even better news... if you just have to overload an operator for a couple classes, you can do that development in C# and compile it to a assembly. Then in your VB.Net project, you can reference that assembly, and call and use it without any hastles. The beauty of .Net....
-
Nov 6th, 2003, 01:11 AM
#3
Thread Starter
Lively Member
Now that's beautiful!
Yeah I know C++ and all and I can easily convert to C#, but for some reason, I find it easier for Windows programs (or mini-programs) like mine to use VB. I actually tried to program Windows apps in C++ -- such a hastle, actually. VB takes care of a lot of stuff for me (Paint() or Repaint(), Terminate(), CreateWindow(), etc.). I don't know, but is that also the case for C#? In VB, just click New Form, and you got yourself a form and it's easier to interact among controls. C# too? I hope so, I'd love to convert to C#.
Call me Deuce.[vbcode]
If User.name = "Deucy" And User.status = "online" Then
Call Deuce()
End If
[/vbcode]
-
Nov 6th, 2003, 01:17 AM
#4
PowerPoster
C# is awesome. I learned it first before VB.Net (although I knew VB6 before .net came along). It is just as easy to use as VB.Net in my opinion. There are small differences, but if you are ok with C++, you won't have a problem. It is more strict than VB.Net is, but the functionality is the same. You can drag controls on the form, and do all the stuff you do in VB.Net. As a matter of fact, most code created in C# will compile to the same IL as VB.Net, and you will notice the code is the same, just a different syntax. If you are comfortable with the ';' at the end of statements, and the {} for code blocks, you won't have a problem.
Here is a link I found. It seems that my earlier statement might not be totally correct as far as the interoperability is concerned:
http://www16.brinkster.com/saifpia/c...erloading.html
I will try to find more on this issue, and if there is more, I will post what I find.
-
Nov 6th, 2003, 01:22 AM
#5
PowerPoster
Ok, it looks like if you overload the == operator, vb.net can't handle it because it doesn't use the operator (but it supports the .Equals() method, which you should implement if it will be called from a vb.net app). But, if you overloaded the + or - operator, it would probably work out just like you expect. I guess if the operators used in C# are the same used in VB.Net, it would be ok. Other difference that pops into my mind is the not equals operator:
<> vb.net
!= C#
-
Nov 6th, 2003, 01:24 AM
#6
Thread Starter
Lively Member
That is some great info. Thanks a bunch, hellswraith.
Yeah, I actually prefer the ";" and "{ }" syntax than VB.NET's (I know, such a paradox, me liking VB's functionality but not the syntax).
As a matter of fact, I'm up for a small project right now, I should give C# a try.
From the link you gave me above. A question arises:
In C++ you can overload the "=" (I'm not talking about "=="), but in C# you can't? That's odd! Unless it wasn't enlisted.
Call me Deuce.[vbcode]
If User.name = "Deucy" And User.status = "online" Then
Call Deuce()
End If
[/vbcode]
-
Nov 6th, 2003, 01:27 AM
#7
Thread Starter
Lively Member
That's true.
Have you actually tried to do that before? It sounds like a working idea, but a lot of doubts come up.
I'm not so serious about doing it right now, I was just talking in general, cos I found a lot of flexibility and new features in VB.NET, I though OP's (overloaded operators) are there, too.
Call me Deuce.[vbcode]
If User.name = "Deucy" And User.status = "online" Then
Call Deuce()
End If
[/vbcode]
-
Nov 6th, 2003, 02:33 AM
#8
I'm pretty sure operator overloading will be in VB.NET in the next version. Although with your background it sounds like C# is the way to go for you. (I can't believe I just said that)
-
Nov 7th, 2003, 10:12 AM
#9
PowerPoster
Originally posted by Edneeis
I'm pretty sure operator overloading will be in VB.NET in the next version. Although with your background it sounds like C# is the way to go for you. (I can't believe I just said that)
Very Funny!
My next project (year long..) is in VB.NET, so I'm coming back to the dark side! 
Now, I need to pick up a VB.NET book, any recommendations?
-
Nov 7th, 2003, 10:42 AM
#10
The best reference book I think is Programming in VB.NET by Francesco Balena (http://www.amazon.com/exec/obidos/tg...glance&s=books), but I bet you wont even need a book. After a few days or a week you'll probably adapt to the syntax changes.
-
Nov 7th, 2003, 11:07 AM
#11
PowerPoster
Originally posted by Lethal
Very Funny!
My next project (year long..) is in VB.NET, so I'm coming back to the dark side! 
Now, I need to pick up a VB.NET book, any recommendations?
You don't need a vb.net book. I had to do a project in VB.Net and it was so simple to get back into. If you know C#, then VB.Net is not a problem (that is if you have vb6 experience, which you do).
What I worry about is how easy VB.Net is to program with because of the implicit casting and what not. I feel like I am so dirty when I do it...lol. I want to go back to C# as fast as possible.
-
Nov 7th, 2003, 04:59 PM
#12
yay gay
Originally posted by hellswraith
You don't need a vb.net book. I had to do a project in VB.Net and it was so simple to get back into. If you know C#, then VB.Net is not a problem (that is if you have vb6 experience, which you do).
What I worry about is how easy VB.Net is to program with because of the implicit casting and what not. I feel like I am so dirty when I do it...lol. I want to go back to C# as fast as possible.
in vb.net you dont need to cast types?
\m/  \m/
-
Nov 7th, 2003, 06:58 PM
#13
Thread Starter
Lively Member
Originally posted by PT Exorcist
in vb.net you dont need to cast types?
Why would you say that?
the C# code:
int i = 10;
while(i)
i--;
will generate a compile error.
Am I correct on that?
Call me Deuce.[vbcode]
If User.name = "Deucy" And User.status = "online" Then
Call Deuce()
End If
[/vbcode]
-
Nov 7th, 2003, 07:01 PM
#14
yay gay
yes it doesnt allow it, and i think its good because they're different types
\m/  \m/
-
Nov 7th, 2003, 07:02 PM
#15
Originally posted by Edneeis
I'm pretty sure operator overloading will be in VB.NET in the next version.
Yup, Whidbey supports operator overloading in VB.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 7th, 2003, 07:03 PM
#16
-
Nov 7th, 2003, 07:25 PM
#17
It will have generics but not anonymous methods, although Vb will also have edit & continue and C# wont.
Actually I don't really miss edit & continue anymore, but I guess it will be nice to have it back.
-
Nov 7th, 2003, 07:48 PM
#18
I wonder how many charact
Originally posted by hellswraith
What I worry about is how easy VB.Net is to program with because of the implicit casting and what not. I feel like I am so dirty when I do it...lol. I want to go back to C# as fast as possible.
I was pretty sure Option Strict disallowed implicit casting in VB.Net.
-
Nov 7th, 2003, 07:55 PM
#19
I wonder how many charact
On a side note, Whidbey looks good:
Operator overloading and COMMENT SUMMARIES! YEH!@!
I wonder what syntax that will follow?
VB Code:
'' SUMMARY
This Function reverses order of collection
'' END SUMMARY
Any guesses?
-
Nov 7th, 2003, 08:42 PM
#20
I think I read some where that it was something like @ or !@ for the comments.
I found my source, according to this guy its '@:
http://www.vsdotnet.be/blogs/tommer/...b-7108e2aad86b
Last edited by Edneeis; Nov 7th, 2003 at 08:52 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|