unnamed file

C/C++

No Description

Guest

Download Edit

Foo *box;
box = (Foo*)malloc(10*sizeof(Foo));
// Für jeden Konstruktor einen individuellen Parameter:
for(int i=0; i<10; ++i) new (box+i) Foo(i*2+1);
cout << endl;
for(int i=0; i<10; ++i) box[i].~Foo();
free(box);
cout << endl;