class member initializer question #2 ---- C++

Status
Not open for further replies.

Lucifre

Full Member level 2
Joined
Jul 5, 2005
Messages
125
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Detroit MI
Activity points
2,389
hi!
If anyone ever experienced this problem?
When i have a class that uses a constructor with member initializers, i cannot create a class array with more objects than 0 of that type? why?
 

C++ only allows arrays of class objects having default contructors.
One solution is to remove your initializers from the constructor so you have a default constructor and then assign your initial values in the constructor body. This is not the preferred way to initialize an object, but works.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…