Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
I don't see anything wrong. I would suggest for good practice also setting your pointers to null when you deallocate them. I sometimes like to define delarr in a preprocessor macro:
#define delarr(X) (delete[](X));((X)=0)
Hope this helps. (Also I may be wrong so more people should check as well)
If good practice is what your after, then it would be a good practice to use standard containers.
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
Why didn't you write a class Matrix???
That's a logical next step, but trying a matrix class without understanding the underlying dynamic memory logistics would be frustrating at best.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401