An object cannot be constructed multiple times. Once it is default constructed, it cannot be reconstructed:
1 2 3
|
flows_table_hour=new Row[12]; // <- they are being constructed here
flows_table_hour[nfcapd](Number/2); // <- so you cannot reconstruct them here
|
What that 2nd line is actually doing is trying to call the parenthesis operator on your existing objects... which if you didn't overload the parenthesis operator, would give you an error like the one you are seeing.
The closest thing you can do to what you want is to construct a new object, then assign it to the old object:
1 2 3
|
flows_table_hour=new Row[12]; // <- construct these as you are
flows_table_hour[nfcapd] = Row(Number/2); // <- then assign these to a newly constructed object
|
However this approach requires the objects be assignable, which means you'll have to overload the assignment operator. You'll probably want to overload the copy constructor, too. And the destructor, if you haven't already.
Also note that your class is going to be error prone as it is now. I highly recommend avoiding direct dynamic allocation (get rid of the new[] calls) and use a container like vector or something. Currently, your default constructor is not initializing the 'flows' member, so when your destructor tries to delete it (which I'm assuming it does)... it will try to delete some random pointer, which will cause your program to crash.
EDIT:
Just to clarify...
if you simply do the example code change above and nothing else it will cause your program to crash or at least leak memory. You
need to overload at least the assignment operator to make this work properly. Or you need to use a container instead of new[].