What's the secret to static class members

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 29 11:22:40 PDT 2016


On 06/29/2016 10:00 AM, Guido wrote:

 > doesn't work.

As others said, everything that you've mentioned do indeed work:

void main() {
     class Grid {
         public:
         static uint xdim;
     }

     class Holder : Grid {
         uint var;
     }

     Grid.xdim = 0;

     auto grid = new Grid;
     grid.xdim = 0;

     auto holder = new Holder;
     holder.xdim = 0;

     import std.typecons;
     Tuple!(float, float, float) test;
     Tuple!(float, float, float) [] array_data;
     array_data ~= tuple(1.0f, 2.0f, 3.0f);

     test[0] = 1.0;
     int i = 0;
     array_data[i][0] = 1.0;
}

Ali



More information about the Digitalmars-d-learn mailing list