This works also:

```

import std.stdio:writefln;
import object: destroy;
import core.memory: GC;
import core.stdc.stdlib: malloc,free;
import std.typecons;

class C {
     int * pa;
     int [] a;
 // Constructor
 this() {writefln("Called constructor");
           pa=cast(int *)malloc(1000*int.sizeof);
           a=pa[0..1000];
          }

}

void dofun()
{
   scope x=new C;
   x.a[3]=5;
   writefln("%12x",&x);

}
int main(){
   dofun();
   dofun();
   return 0;

}

```



  • Re: How to free ... Alain De Vos via Digitalmars-d-learn
    • Re: How to ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: How to ... Steven Schveighoffer via Digitalmars-d-learn
      • Re: How... Alain De Vos via Digitalmars-d-learn
        • Re:... Alain De Vos via Digitalmars-d-learn
          • ... Steven Schveighoffer via Digitalmars-d-learn
        • Re:... Steven Schveighoffer via Digitalmars-d-learn
      • Re: How... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
        • Re:... Alain De Vos via Digitalmars-d-learn
          • ... drug007 via Digitalmars-d-learn
            • ... Alain De Vos via Digitalmars-d-learn
              • ... drug007 via Digitalmars-d-learn
            • ... Alain De Vos via Digitalmars-d-learn
  • Re: How to free ... Nick Treleaven via Digitalmars-d-learn

Reply via email to