Best way to reference an array in a child class...

captain_fid bell.hue at gmail.com
Thu Mar 6 15:55:18 PST 2014


Well, actually... take it back.

When I did try this syntax, I receive(d) the following error. I 
then went and created this test which I thought couldn't go wrong.

with both dmd and gdc ...



struct S
{
   int a;
   string b;
}

class A
{
    S[] items;
    abstract void doit();
}

class B: A
{
    this() {items = [ {10, "first"}, {20, "second"}];}    // line 
21
    override void doit() { }
}

(21): Error: found '}' when expecting ';' following statement
(21): Error: found ',' instead of statement



More information about the Digitalmars-d-learn mailing list