I'm looking forward to VB7, but MS doesn't wanna say anything about it (well, almost).
So, does anyone know what new features will be included in VB7 (or Visual Studio.net)?
(Besides the tray icon control, I heard that from a friend) :)
Printable View
I'm looking forward to VB7, but MS doesn't wanna say anything about it (well, almost).
So, does anyone know what new features will be included in VB7 (or Visual Studio.net)?
(Besides the tray icon control, I heard that from a friend) :)
shouldn't this be posted in the chit chat section?
I saw a 40 min video-presentation that MS had, back in Feb and I remember them saying that VB7 will be using DHTML stuff a lot more, and Internet related things...I'll try to find the link to the video so you guys can see it...
-Emo
Encapsulation, Inheritance, Polymorphism, Threading.
What's polymorphism?
The ability for a class to inherit from more than one other class.
I think.
;)
This is polymorphism
They have the same name, but they work completely different(you can have as many as you like, but they all have to have different arguments).Code:Public Function MyFunc(Arg1 As Long, Arg2 As Long) As Long
MyFunc = Arg1 + Arg2
End Function
Public Function MyFunc(Arg1 As String, Arg2 As String, Arg3 As String) As String
MyFunc = Arg1 & Arg2 & Arg3
End Function
when I first heard of polymorphism I thought it had something to do with image manipulations :rolleyes:
V(ery): dont you mean Multi-Threading??
and BTW I have always wondered this, what are the advantages of having more than one thread?
why do you need it?
Delphi is multithreaded, and you can create a thread using API, but what does this do?
does it allow you to do two things at the same time?
for example
Code:Thread Thingy ma-bobber #1
Do this
Thread Thingy ma-bobber #2
Do that at the same time that you are doing this
???
[Edited by denniswrenn on 09-02-2000 at 02:28 PM]
I don't know about multi-threading, but polymorphism looks cool:
So if for example I call SomeRoutine like this:Code:Sub SomeRoutine(Arg1)
'Some stuff...
End Sub
Static Function SomeRoutine(Arg1 As Long, Arg2 As String) As String
'Some other stuff...
End Function
Will the first line call the second routine, and the second line call the first routine?Code:A$ = SomeRoutine(2, "Cool")
Call SomeRoutine(Now)
I'm feeling vicious... :p
What about this:
And this is my code:Code:Public Sub ViciousRoutine(Arg1 As String, Arg2 As Long)
'Some code...
End Sub
Public Function ViciousRoutine(Arg1 As String, Arg2 As Long) As Long
'Some OTHER code...
End Function
What happens here?Code:Const VB_Do = 4
ViciousRoutine "What will", VB_Do
[Edited by Sc0rp on 09-02-2000 at 03:59 PM]
ummm that would give a type mis-match error....
I just fixed it. :D
I expect it will do one of two things:
1. Refuse to compile
2. Choose depending on whether you assign the return value:
In this case, when you assigned it to x, it would use the Function. When you ignored the return value, it uses the Sub instead.Code:Public Sub ViciousRoutine(Arg1 As String, Arg2 As Long)
'Some code...
End Sub
Public Function ViciousRoutine(Arg1 As String, Arg2 As Long) As Long
'Some OTHER code...
End Function
Public Sub Test()
Dim x as Long
x = ViciousRoutine("Hi", 50)
ViciousRoutine "Different", 100
End Sub
Dennis - in multithreading, you can do cool things like this:
You have a program that (say) creates a fractal image. You want to make it simple, so you have your second thread, which draws the picture. What the main thread does, is start the second, then wait for the user to hit escape. If they do, it then stops the second thread.
Procedure overlaying is what you are discussing here is one type of polimorphism.
Two (or more) procedures with the same name but with different signatures (that is the number or types of arguments).
The code Sc0rpe suggested is the essens; two procedures with the same names but with different arguments.
I don't know however if one can be a Sub and the other a Function or if they have to be of the same type of procedure (for that I think we just have to wait and see how MS implements it).
The code sample that parksie supplied can actually be done today using Property procedures.
An other form of polymorphism (that allready exists in VB) is to call different objects in the same manner.
You can do this today by using interface classes and the Implements keyword.
emo, you need to fix the link to alladvantage in your signature :)
I think the type of polymorphism discussed here is function overloading
(God, does that sound techy or what?)
Very techy :D. Another cool feature (AFAIK it's only in C++) - Operator Overloading. Basically, you can do stuff like this:
It lets you define custom functions for stuff like +/-/divide/multiply/equals/comparison and all the rest of it.Code:Dim A as New MyClass
Dim B as New MyClass
A = "hello"
' ==> A.m_Str = "hello"
B = "another"
' ==> B.m_Str = "another"
Debug.Print A + B
' ==> prints "hello_another"
I know, I've just read about that on my book, and it looks really good.
What book do you have?
Learn C++ in what seems at first 21 days but you'll spend a week or two on day 8 and 9 (pointers and references) ;)
I'm learnin C++ until I feel confident enough to do VC++