>> How to intialize array in Constructor initializer list?
You can't, it's not possible to initialise a member array in a constructor initialisation list. You have to do this in the constructor itself.
Main Topics
Browse All TopicsAn object in Constructor initializer list is intialized as follows:
x(2, 3, 5),
x is a private member of class1. x is object of type class2. class2 has 3 private
members, which are intialized in above constructor to 2, 3, 5.
What if x was array of objects. How would the initalizer list look then?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
>> Actually it can be done
I mean you should post an explanation with your code example... since not everyone will know what placement new is or how to use it.
Placement new can be tricky to use safely, more so than your simple example eludes. It's very easy to write code that can leak (amongst other potential issues).
naseeam, if you decide to consider LMB's idea I suggest you take a look at these first.
http://www.parashift.com/c
http://www.parashift.com/c
-Rx.
Business Accounts
Answer for Membership
by: jkrPosted on 2009-11-03 at 16:03:02ID: 25735248
If x was used as an array, e.g.
x* p = new x[42];
all you can use is the default constructor. No others are possible.