How do I instantiate a class as invariant?

Craig Black craigblack2 at cox.net
Wed Apr 2 23:49:20 PDT 2008


I can't figure out how to instantiate a class as invariant.  The following 
code issues this error:  cannot implicitly convert expression (new A) of 
type hello.A to invariant(A)

class A {}

int main(char[][] args)
{
  invariant A a = new A;
  return 0;
}

-Craig 




More information about the Digitalmars-d mailing list