Aint* func(int n) {
int* p = new int[n];
return p;
}
Bclass Bar {
public:
Bar() {}
~Bar() {
delete[] _p;
}
void set(int n) {
_p = new int[n];
}
private:
int* _p;
};
Cclass Foo {
public:
Foo() {
_p = new int;
}
~Foo() {
delete _p;
}
private:
int* _p;
};