I have 3 files
dimentions.h:
namespace mtm {
class Dimensions {
int row, col;
//some code
};
}
IntMatrix.h:
#include "dimentions.h"
namespace mtm
{
class intMatrix
{
private:
int** data;
int col;
int row;
public:
intMatrix(Dimensions dims, int num=0);
//some code
};
//the line bellow is where I get the error
intMatrix(Dimensions dims, int num=0): col(dims.getCol()),row(dims.getRow()) ,data(new int*[dims.getRow()])
{
for(int i=0;i<dims.getCol())
{
data[i](new int[dims.getCol]);
}
for(int i=0;i<dims.getRow();i++)
{
for(int j=0;j<dims.getCol();j++)
{
data[i][j]=num;
}
}
}
}
the compiler says: expected ‘)’ before ‘dims’ and when I put the mouse at dims, vs code says: " error-type mtm::dims" but dims is not a type it is a vriable.
IntMatrix.cpp:
#include "IntMatrix.h"
using namespace mtm;
//some code
in IntMatrix.cpp the problem is that it doesn't recognize what Dimentions is , however it does recognize what intMatrix is.