Object on free store
How do you create an array of a class on a free store with defined constructor?
[source]
MYCLASS * someClass;
//normally
someClass = new MYCLASS[5];
//but with constructor
someClass = new MYCLASS(param, param)[5];
[/soure]
doesn''t work, how could it be done?
MYCLASS** someClass;someClass = new MYCLASS*[5];for(int i=0;i<5;i++)someClass<i>= new MYCLASS(param, param);for(int i=0;i<5;i++)delete someClass[i];delete[] someClass;
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement