CannibalSmith (cannibalsmith) rakstīja koderi kopienā, |
class House { House(); ~House(); Room room; Chair* chair; } House::House() { chair = (Chair*) malloc(sizeof(Chair) * n) for (int i = 0; i < n; i++) { new(chair + i) Chair(room); } } House::~House() { for (int i = 0; i < n; i++) { delete chair + i; } free(chair); }
Nopūsties: