Hi,
the system in my uni has finally been upgraded and now I am having
some problems to compile my code.
I want to initialize an array of an object but this is not allowed
anymore. I found some discussions about this issue but no solution how
to rewrite it. Simplest case when this problem happens:

**************************************************************
class array
{
private:
public:
        int s;
        array(int i)  {s = i;}
};


int main()
{
        array *test;
        test=new array[5](123);
}
***************************************************************

Compiling this code gives following error message:

$ g++ test.cpp
test.cpp: In function âint main()â:
test.cpp:22: error: ISO C++ forbids initialization in array new


How do I have to write the code to get the same result? I don't want
to add an extra function to initialise my objects.

Thanks,
Florian
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to