To call a member function of an object instance to which you have a pointer, you use the -> operator, although (*pointer).function() does work of course. Use pointer->function() instead.
Thanks, I'm not really all that familiar with classes in C++.
Your deletes look wrong to me. *tiles[ i ] is of type Tile*, not Tile**, and equal to tiles[ i ][0], which you just deleted. What happens when you use the code I gave you?
Read all of this, particularly this.
Your code gives:
Heap block at 00BE1FA8 modified at 00BE1FD4 past requested size of 24
Thanks for the link, it was quite helpful. I understand why the code I posted above is wrong now, but I'm still at a loss as to the correct code.
What I'm doing at the moment will delete all the individual Tiles (three times each >.>), but leave the pointers for each row and the pointer to those pointers. Is that correct? Your code should be deleting both of those, and I understand why it should be, but it isn't for some reason.
I'm compiling this using Visual Studio Express 2008, if that helps.
Hi Alex,
Is there any reason not to use STL vectors?
Working with C-style arrays can be very troubling.
To be honest, I only really know C, but since I'm using a C++ compiler and know Java OOP fairly well I thought I'd chuck a couple of objects. I've never used vectors before, but it does look quite similar to a Java List. I might give it a shot if I can't get this working.
EDIT: Ok I've redone it with vectors. I had one of my compiler options configured wrong, which for some reason only chose to explode the linker when using vectors. But anyway, half an hour and half a glass of caffeine later it works! I'm still interested in the solution to the delete problem above if anyone can figure it out.