Issue with code, can't access a function in other class!

Hi, I would really appreciate any help for this as I am struggling a little to get my head around this, so I am essentially trying to get a value from a 'Matrix' that is created. Using a function in the class where the matrix is created. But when trying to do this I get the error: Call to non-static member function without an object argument in this line when trying to call the function:

Matrix::get(sizeR, sizeC);

Let me know if you need more, and I will be happy input whatever !

THANK YOU!!!
The problem is that the compiler doesn't know which matrix you're referring to:
1
2
3
Matrix a;
Matrix b;
Matrix::get(sizeR, sizeC);    // get size for a? For b? Some other matrix? 

You want to call the method on a specific matrix, e.g.:
b.get(sizeR, sizeC);
Doing this though gives me an error saying: Calling a private contractor of class 'Matrix' ??

Is the function a private member of the class Matrix? If so, you can't call it from outside other methods in the class. make it public and you'd be able to call it using b.get( a, b) inside of main.
Nope, all are public, is it something to do with actually having this function inside of the class which is a constructor class for the matrix? As it is still giving me the same issue
Are you saying that you saying that Matrix is a subclass of ConstructMatrix? If so, does the function access private members of the ConstructMatrix class? If that is the case, then you're having a problem with inheritance. Subclasses can't inherit private members of the parent class, so whatever values the get function is trying to access need to be protected rather than private at the very least.
Oh okay, that may be the issue actually, as yeah the constructMatrix is within the matrix class, and a variable is used in the class and then changed in the subclass construct. I may just rewrite it and see if I can get my head around this, but please continue to try help, as it would be much more convenient! :P
Topic archived. No new replies allowed.