Code security: "auto" / Reason for errors

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Wed Mar 2 23:18:37 PST 2016


On 2016-03-02 22:23, Ozan wrote:

> Yes, but D handles basic datatypes (int, char, ...) different to objects
> (similar to Java).

Arrays in Java and most other languages in the C family behaves the like 
in D. Example:

class Foo
{
     public static void main (String[] args)
     {
         int[] a = new int[5];
         a[0] = 3;

         int[] b = a;
         b[0] = 8;
         System.out.println(a[0]); // prints 8
     }
}

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list