I am trying to create a simple matrix class. When an object of class matrix is created it should be able to create any nxn size matrix. The problem I am finding is that there doesn't seem to be a simple way to make a class with a dynamic 2D array. Most of the examples I find online are extremely complicated. Any advice on I might solve this? Any links that might help or code snippets to aide would be greatly appreciated.
#include<iostream>
using namespace std;
class Matrix
{
public:
Matrix();
Matrix(int r, int c);
private:
int rowNumber; //number of row in the matrix
int colNumber; //number of columns in the matrix
};
Matrix::Matrix()
{
rowNumber=0;
colNumber=0;
}
Matrix::Matrix(int r, int c)
{
rowNumber=r;
colNumber=c;
}
int main()
{
return 0;
}