如何用new定义class数组(constructor带参数)?# JobHunting - 待字闺中
j*2
1 楼
e.g.
class test
{
int t;
public:
test(int n):t(n){}
};
test *p=new test[100];//有办法把参数放一句话里吗?还是只有一个个set t?
class test
{
int t;
public:
test(int n):t(n){}
};
test *p=new test[100];//有办法把参数放一句话里吗?还是只有一个个set t?