改错题:
class foo
{public:
foo(int j) {i=new int[j];}
~foo(){delete i;}
private:
int *i;
}
class derive:foo
{
public:
derive(char j){i=new int[j];}
~derive(){delete i;}
private:
char *i;
}
main()
{
foo *f=new foo(100);
foo *d=new derive(200);
*f=*d;
delete f;
delete d;
}