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.
here is an example from an application that I am currently working on:
With Table1.Rows(0)
_ .Cells(0).Text = "CatNum"
_ .Cells(0).Width = Unit.Pixel(400)
_ .Cells(1).Text = "Description"
_ .Cells(1).Width = Unit.Pixel(1500)
_ .Cells(2).Text = "Quantity"
_ .Cells(2).Width = Unit.Pixel(150)
_ .Cells(3).Text = "Unit Price"
_ .Cells(3).Width = Unit.Pixel(185)
_ .Cells(4).Text = "Total Price"
_ .Cells(4).Width = Unit.Pixel(185)
End With
I could change this to display on row 1 or 2 or 3 by changning just one single number and not using a constant. It is also easier to read. The underscores are there just so it's spaced properly.