I'm trying to create a program that creates an array that behaves like a matrix with the ability to get any value I chose. So far I have run into a problem where I get the error:
"`double* matrix::get(int, int)' and `double* matrix::get(int, int)' cannot be overloaded"
when I try to compile in unix. Any help I could receive to explain why this error is occurring would be greatly appreciated.
#include <iostream>
struct matrix {
protected:
double * * data;
int rows, columns, size;
public:
matrix(int row, int column) {
size = row * column;
columns = column;
rows = row;
data = new double * [size];
}
double * get(int row, int column);
void set(int row, int column, double value);
void resize(int row, int column);
matrix clone();
I think that the compiler you are using has a bug. It shall not allow to declare a member function with nested name specifier. That is the following declaration is incorrect
double * matrix::get(int row, int column) {
As for the error message issued by the compiler then it considers the following declarations as two overload functions
double * get(int row, int column);
double * matrix::get(int row, int column) {
Place the second declaration that is a definition at the same time outside the class definition.