I'm working on a project, and I have the following classes:

  • Loader - This loads the contents of the text file
  • Matrix - This processes the data that has been loaded

Now I'm using association, Loader -> Matrix

In my matrix class I have a method that calls the object of the loader:

bool Matrix::Load()
        return false;
    int* data = loader.getData();
    for(int i=0; (i < columns); i++)
        for(int j=0; (j < rows); j++)
            matrix[i*rows+j] = data[i*rows+j];
    return true;

In my Matrix class I'm defining a new object of the Loader class:

Loader loader;

Everything is fine, it all works, right up until I initialise a new object in main of class Matrix, then it returns either a Bus error or a Segmentation fault: 11..

I haven't done Association in a long time, but, I think it's something to do with how I'm initialising the loader Object.

Anyone have any suggestions?

6 Years
Discussion Span
Last Post by histrungalot
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.