-
Class arrays
I have two classes. The .h files go something like this:
Code:
class ClassA {
...
public:
ClassA::ClassA();
ClassA::ClassA(int x, char array1[], char array2[]); <-- constructor which sets some private variables
...
}
Code:
class ClassB {
Private:
ClassA classArr[];
...
Public
ClassB::readFile(string path);
...
}
inside readFile(string path) function this line causes the program to die and the IDE gives me no error, just crashes. I want to know what's wrong with this assignment.
Code:
classArr[i] = ClassA(anInt, aCharArr, aCharArr2);
EDIT: Okay, so I guess the issue was that since I only defined the array in header file, I never gave it a size.
-
Ooh, we get to guess what's in all the dots! This is exciting.
Probably i has gone out of bounds.