Originally posted by: XZeroII
Originally posted by: Descartes
Originally posted by: Deeko
Originally posted by: XZeroII
Originally posted by: Deeko
I don't know either language...but that seems terrible ineffecient compared to objects in C++.
foo.bar = 1
if its public, if private then a function
foo.setbar(1)
seems alot easier.....
No, you don't understand. Let's say you have a bunch of properties to set in an object. Instead of:
foo.bar = 1
foo.me = 2
foo.peanut = 3
foo.missile = 4
you can do this:
With foo
.bar = 1
.me =2
.peanut = 3
.missile = 4
End With
you can also use methods and such this way too. It's very nice with nested classes.
As for your question, I don't think there is. You might be able to create a macro, but I don't know if there are macros in Java.
so right an overloaded function foo.Set, with the possibility of one or all of the variables.
I actually didn't read this before I responded a moment ago.
This is, imo, a poor solution. It is not type-safe, so validation will have to be added for *every* value in the mutator method. This can only guarantee compile-time type safety. An enum would obviously be 3000% better, but Java doesn't support them.
Either way, it's not a very OO way of doing things.
That's true, but that was just an example. You can do this with methods and properties as well. It comes in very handy at times. I guess you just need to use it a few times before you understand, I know I didn't understand it's usefulness until I used it a few times.
I was referring to Deeko's overload suggestion, not VB's With
...
With oCmd.
.CommandType = adCmdStoredProc
.CommandText = "SomeSproc"
.Parameters.Add oCmd.CreateParameter(...)
.Execute
... etc.
End With