How to initialise dynamic arrays of objects?

Hi. Say I have a class called Play

now I have a constructor called Play(int, char, int);

I create Play play=new Play[2]()//default const

Now i want to initialise different values of play objects using play(int char int)

Whats the syntax? play[i](vale, value value); ? Its not working..pls help
You can't do it in the way you are hoping. I would recommend just using vectors or another dynamic container for this purpose, using emplace_back() to construct new objects on the end of the vector. If you really want to use dynamic memory yourself, I believe you can accomplish your goal using placement new, but that's not something I've ever used.
I guess then I have to use setter functions to give values to arrays of objects
Are you doing an assignment where you are required to use arrays? I would really recommend just using vectors.
Yes..We havent learnt vectors yet..thats for our CSCI204 OOP course..We are only learning basic classes and Advanced C++ in CSCI124
Topic archived. No new replies allowed.