程序代码:
#include <iostream>
using namespace std;
class Foo {
public:
Foo(int value) {
cout << value << endl;
}
};
int main(int argc, char *argv[]) {
Foo **arr = new Foo *[3] {new Foo(1), new Foo(2), new Foo(3)};
delete arr[0];
delete arr[1];
delete arr[2];
delete[] arr;
}