I'm trying to relearn C++ by writing a program that manipulates matrices and blah blah blah moving from Java. So far I have this:
[snip]
class Matrix
{
private://all private members get a pr_* prefix to distinguish them
int pr_rows, pr_cols;
double pr_Matrix[0][0]
bool pr_isSquare() { return (pr_rows == pr_cols); }
public:
Matrix(int, int);
[snip]
};
Matrix::Matrix(const int rows, const int cols)
{
pr_rows = rows;
pr_cols = cols;
pr_Matrix = new double[pr_rows][pr_cols];
}
[snip]
When I try to compile, I get
"error: 'Matrix::pr_cols' cannot appear in a constant expression"
Can someone help me with this? I've tried Google, and I think I understand what's causing the problem, but I don't know how to work around it.