Advertisement

Object on free store

Started by November 02, 2000 08:25 PM
0 comments, last by vbisme 24 years, 2 months ago
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