I define a class for generating matrix and there is no bug there but when in main program I want to see the matrix output it shows me nothing, I am not attaching the class, because it's a long code, but I am attaching the main code and i want to know if there is any problem here or not.
First of all, that should not show "nothing", because there are the cout << " " and cout << endl. Granted, whitespace is harder to see.
If you don't get even the whitespace, then GetNumRows() and GetNumCols() return 0 or less.
If you do get whitespace, then GetElement() returns unprintable content.
The only other members of Matrix2D that you use are:
* Custom constructor Matrix2D(int,int,T*)
* Copy constructor
* Destructor
If your code has no bugs and the main code does not have bugs, then who does?
PS. You don't use anything from <string> or <math.h> here. Do not include what you don't need.
Besides, <math.h> is from C library. In C++ you would use the <cmath>.
L10 Pass matrix by const ref and not by value. This is currently doing a copy-by-value and unless you're got the copy constructor correct (and tested) then this could be the issue. In case, to avoid the overhead of the copy it should be passed by const ref.