I am creating a program to calculate and display call statistics. When the default constructor is called and it goes to allocate memory for an array for the call stats it falls into an infinite loop. I have identified the problem to be at call_DB = new CALLS[CAPACITY]; but I can't seem to get it fixed. Could someone give me some pointers on what to do?
new calls constructors on each of the elements of the array, so you fall into infinite recursion.
Basically, don't allocate objects of a given type inside the constructor of that same type.
No, because I don't know what you're trying to accomplish.
What you have now (if we pretend it terminates) would create a pental tree structure.
My wild guess is that CALLS should hold an array of some other type, and probably nothing else. This other type is the one that should hold cellPhoneNumber, relays, and minutes.
I figured it out. I created another class in the same header file with records in it and used it in place of CALLS and it compiled fine, but now I am having an issue with my explicit value constructor. It won't let me input items from a file to the an array in it. I am getting this error " error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'call_record' (or there is no acceptable conversion)". It is occurring at "input>>call_DB[count++];".