On Sun, 17 Feb 2013 17:00:19 -0500, Michael <p...@m1xa.com> wrote:


That's not the meaning of static in that context.
As I understand a static class can't be instantiated.

Static in that position is a no-op. The compiler (infuriatingly sometimes) accepts attributes that have no meaning silently.

So in mine case if I want purely static class I need to use:

static Test
{
   static void foo();
}

A class that can't be instantiated has a private constructor. In addition, if you want to make all the functions static, in D you can either put them in a static scope, or use the colon:

class Test
{
   private this() {}; // will never be instantiatable
static: // all members after this will be static. Could also use static { ... }

   void foo(); // a static function
   int x; // a static variable
}

-Steve

Reply via email to