+ 1
Why “queue=new A[100];” cannot replace by “A queue[100];”?
template <typename A> class Queue { int size; A* queue; //定义一个指针变量,它的类型由生成实例时的参数决定 //int* queue; public: Queue() { size = 0; queue=new A[100];//此处不能写成 A queue[100];会溢出和报错 } …};
1 Resposta
+ 1
What are they different?