问答题
#include < iostream.h >
class Samp
{ public:
void Setij(int a, int b){i =a, j =b; }
~ Samp()
{ cout << "Destroying.. " << i << endl; }
int GetMuti() { return i * j;}
protected :
int i;
int j;
};
int main()
{ Samp * p;
p = new Samp
____
;
if( ! p)
{ cout << " Allocation error\n" ;
return 1;
}
for(int j =0; j <5; j ++ )
p[j]..Setij(j, j);
for(int k =0; k <5; k ++)
cout <<"Muti[" <<k <<" ] is:" <<p[k].______<<endl;
______
return 0;
}
【参考答案】
GetMuti()
delete []p;