I am writing a class for matrices by the name of Matrix. I have an empty constructor Matrix() where I initialize the dimensions (rows and columns) of the matrix to zero. This is because I would like the user in the main program to set the dimensions through another overloaded constructor or other explicit means. However, in case the user fails to set the dimensions of the object of class Matrix, the dimensions will remain at 0. I have written the following function that checks for undefined dimensions that works:

Code:
	void dimension_check(const Matrix &mat2) const {
		if ((mat2.rows==0)&&(mat2.columns==0)) {
			cout << "Error. Matrix dimensions undefined.\n";
			exit(1);
		}
		return;
	}
I would like to make a change where it will print an error output giving the name of the object that has not been defined.

i.e in the main program if I define

Code:
Matrix ABC;
The error message should read "Error. Matrix ABC dimensions undefined." Thus the user will know where the error is.

Thanks.