It is a bug ?
Du Liang
duliang.21 at 163.com
Wed May 6 07:06:27 PDT 2009
import std.stdio;
class AB{
int A;
int B = 2;
int[] arrA;
int[] arrB = [2,2,2]; // arrB is static in[] or bug ?
this(){
this.A = 1;
this.arrA=[1,1,1];
}
}
void main(){
AB ab1 = new AB();
AB ab2 = new AB();
writeln(ab1.A, " | " ,ab1.B, " | " ,ab1.arrA, " | " ,ab1.arrB);
writeln(ab2.A, " | " ,ab2.B, " | " ,ab2.arrA, " | " ,ab2.arrB);
writeln("change...");
ab1.A = 10;
ab1.B = 20;
ab1.arrA[0] = 10;
ab1.arrB[0] = 20; // ab2.arrB = 20 why? bug?
writeln(ab1.A, " | " ,ab1.B, " | " ,ab1.arrA, " | " ,ab1.arrB);
writeln(ab2.A, " | " ,ab2.B, " | " ,ab2.arrA, " | " ,ab2.arrB);
readln();
}
More information about the Digitalmars-d
mailing list