...
...

Signature
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Lasse Reichstein Nielsen a écrit :
> > Why does this method alter the array "double[][] A", if the only one
> > whose elements are being set is "double[][] C" ?
[quoted text clipped - 14 lines]
> DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
> 'Faith without judgement merely degrades the spirit divine.'
Ok thanks a lot. Clearly I'm new to OOP.
Yomi Smito - 04 Jun 2006 02:55 GMT
I'm fixing it by using a more generic "C[i]=new double[A[i].length];"
instead. Thanks.
blmblm@myrealbox.com - 04 Jun 2006 17:21 GMT
>Lasse Reichstein Nielsen a écrit :
>
[quoted text clipped - 12 lines]
>
>Ok thanks a lot. Clearly I'm new to OOP.
I don't think this is an OOP thing so much as it is a Java thing.
In Java, all you have are primitives and references, and assignment
can't be overloaded. In C++, things are different, and they might
be in other OOP languages as well. (Actually, you would have other
problems passing a multidimensional array as a parameter in C++,
but that's further off-topic.)
Just a nitpick, possibly useful if/when you later learn another
OO language.

Signature
B. L. Massingill
ObDisclaimer: I don't speak for my employers; they return the favor.
Dimitri Maziuk - 05 Jun 2006 17:28 GMT
Yomi Smito sez:
> Lasse Reichstein Nielsen a écrit :
>
>> > Why does this method alter the array "double[][] A", if the only one
>> > whose elements are being set is "double[][] C" ?
...
>> Arrays are objects, so when storing them, you store a reference.
...
> Ok thanks a lot. Clearly I'm new to OOP.
This has nothing to do with OOP and everything with Java's type
system and terminology. All objects are pointers, and that's what
"reference" means. When it comes to objects, the promise to pass
everything "by value" means "pass the value of the pointer".
So the assignment operator doesn't do what you expect.
Dima

Signature
Well, lusers are technically human. -- Red Drag Diva