c++ - Something like new but to allocate 2 rooms -


i have member function must create 2 objects of class (in memory). must return pointer "p", want access objets p[0] , p[1]. know keyword new, allocate memory 1 object. there similar allocate contigous memory 2 objets ? can create 2 cells array (two pointers) using keyword new 2 times, preferer easier solution (p[0] , p[1]).

 myclass * p = new myclass[2]; 

and remember delete with:

delete[] p; 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -