"Thomas G. Marshall" <
[email protected]>
wrote in message : flintridgeparkenfarker vonkerschnauzerheiden III (joe) <
[email protected]>
: horrified us with:
:
: > : >> : >>> "flintridgeparkenfarker vonkerschnauzerheiden III (joe)"
: >>> : >>>> The calling function is in a class which imports another class and
: >>>> calls a function from the imported class. The calling function
: >>>> sends an array of file objects as a parameter. Attempting to
: >>>> access an element of the array causes a multitude of errors.
: >>>>
: >>>> Passing strings and such work okay, but passing by reference [I
: >>>> guess] doesn't make it through the wash. Am I going to have to
: >>>> physically move the imported functions into the calling functions
: >>>> module?
: >>>>
: >>>> Thanks for any input.
: >>>>
: >>>> joe
: >>>>
: >>>> --
: >>>> "To be is to do."--Plato.
: >>>> "To do is to be."--Socrates.
: >>>> "Do be do be do."--Sinatra.
: >>>>
: >>>>
: >>> More details? Code maybe? And if you're passing strings, you're
: >>> passing by reference.
: >>
: >> Unless it's not Java, you're passing by value.
: >>
: >> - Virgil
: >>
: >>
: >
: > Thanks for your response. I see what I've been doing wrong though.
: > [oversight]
: >
: > Although, to address one point, when I pass an array to another
: > function I can alter the array in the receiving function and those
: > changes will be reflected in the calling function's array, just like
: > c++. I realize Java passes arguments by value but it looks like it
: > may handle arrays the same as c++, by passing the address to the
: > first element. Of course I'm only presuming here.
:
:
: No, it's passing the reference of the array object (as a value). It can
: look much like what happens in C, but it is very different.
:
: Java arrays are confusing for people with C/C++ backgrounds because it is
: hard for them to grok the notion of Java arrays as fully blown objects.
:
: For instance, when you create an array of 3 objects, you are creating 4
: objects: one for the array itself, and 3 more for each of the objects.
:
: Arrays of primitives are a little more like C's here since all you need do
: is create the array object and you get all the primitives, since
primitives
: need no object-like allocation, but you still need to allocate once for
the
: array object itself.
:
: When you send the array, you are not sending a pointer to the first
element.
: You are sending a pointer to the array object itself.
:
:
I admit being confused over this issue. In my mind, if I can change the
value of a variable/object in a calling function via a parameter, then it
seems like I have a reference to a memory location. I can't help wondering
if this isn't an exercise in semantics. Either way, it doesn't matter--I
can't get this thing to work anyway.
I'm just fooling with the file compression utility and whenever I attempt to
access anything other than the local directory or a sub, I get "Access
Denied" errors. If the sub directory has a sub, "Access Denied."
I read something about this issue but the statement was brief and I don't
know the context in which it was written.