#include // --------------------------------------------- MatrixNxN: Dynamic size matrix class MatrixNxN { public: double *A; int N; /* ------------------------------------------ Constructor 1 ------------------------------------------ */ MatrixNxN() { cout << "Invoking Constructor 1" << endl; } /* ------------------------------------------ Constructor 2 ------------------------------------------ */ MatrixNxN(int n) { cout << "Invoking Constructor 2: making a " << n << "x" << n << " matrix" << endl; A = new double[n*n]; N = n; } }; int main(int argc, char *argv[]) { cout << "Processing: MatrixNxN m1" << endl; MatrixNxN m1; cout << "Processing: MatrixNxN m2(4)" << endl; MatrixNxN m2(4); cout << "Processing: MatrixNxN m3[4]" << endl; MatrixNxN m3[4]; MatrixNxN m4[4] = {MatrixNxN(2), MatrixNxN(3), MatrixNxN(4), MatrixNxN(5)}; }