Code: Alles auswählen
class C {
private int zahl;
public C(int z) {
zahl = z;
}
public int getZahl() {
return zahl;
}
}
class Test {
static public C c = new C(123); // Classe ist statisch
static public int[] i = { 1, 2, 3, 4 };
}
Code: Alles auswählen
TC = class
private
Zahl: integer;
public
constructor Create(z: integer);
end;
Ttest = class
const
i: array[0..3] of integer = (1, 2, 3, 4);
C: TC = TC.Create(123); // ist static, gibt Fehler
end;
Nur, kann ich dies nicht in den Constructor nehmen, da die Classe statisch ist und nur 1mal mit Create initialisiert werden darf.