C++ 中 myobject * a =new myobject[n] 的问题# Programming - 葵花宝典
k*l
1 楼
假设myobject 只有一个带参数的constructor: myobject(int parm),
^^^^
myobject * a =new myobject[n]
编译的时候说找不到 myobject() to initialize a vector.
试图加入参数: myobject * a =new myobject[n](parm)
又说 No initializer allowed for new of an array
请问有什么好办法解决这个问题?
^^^^
myobject * a =new myobject[n]
编译的时候说找不到 myobject() to initialize a vector.
试图加入参数: myobject * a =new myobject[n](parm)
又说 No initializer allowed for new of an array
请问有什么好办法解决这个问题?