int** matrix = newint*[3];matrix is a pointer to an array of three pointers to integer.
*matrix = newint[2];
The next line initializes the first pointer to point to an array of two integers. Same as matrix[0] = newint[2];
matrix[0][1] = 4;
The last line changes one of the integers. Note that matrix[0] is the only valid entry so far, accessing any others is undefined behavior.
Well If I completely delete the cout, the program runs nice and clean.
It should give me at least an error for returning something different from the function-return-type.
Strange behavior O.o
EDIT:
This only happens when using templates...
But I actually instantiated a Matrix<> object, so the template should've been compiled and the compiler should've generated an error