Multiple distinct objects: Difference between revisions
Content added Content deleted
(→{{header|Modula-3}}: added the mistake) |
(→{{header|Modula-3}}: fixed a typo introduced by the new version) |
||
Line 884: | Line 884: | ||
END DistinctObjects.</lang> |
END DistinctObjects.</lang> |
||
{{out}} |
{{out}} |
||
Each line interleaves the initial values of <code>a</code> and <code>b</code>. The first one has default values; the second replaces the values of <code>a</code> with random, "re-initialized" integers. Only <code>a[3]</code> starts with the default value for <code>T</code>; see the |
Each line interleaves the initial values of <code>a</code> and <code>b</code>. The first one has default values; the second replaces the values of <code>a</code> with random, "re-initialized" integers. Only <code>a[3]</code> starts with the default value for <code>T</code>; see the seventh number in the first line. On the other hand, the modification of "one" element of <code>c</code> actually modifies every element, precisely because it is a reference and not an object. |
||
<pre> |
<pre> |
||
3 , -9 , 100 ; 4 , 2 , 100 ; 2 , 6 , 100 ; |
3 , -9 , 100 ; 4 , 2 , 100 ; 2 , 6 , 100 ; |