Well, at first I thought GetImage() is the error because I thought that it actually loads an image from the harddisk each time it is called. But it doesn't - it returns a local image.
In that case, you are caling SDL_FreeSurface() on that image, which is local to CGraphics. The first time it is ok, but the second time the image is already deleted. So from here:
void CTile::MakeTile(string id, int xpos, int ypos, int type){/* this function is where acces violation happens*/ ID = id; SDL_Surface *Tile; Tile = TileImage.GetImage(ID); TileRect.w = Tile->w; TileRect.h = Tile->h; TileRect.x = xpos; TileRect.y = ypos; Type = type; SDL_FreeSurface(Tile);}
Take out the red part (SDL_FreeSurface(Tile);).
Now CGraphics should be the one who "frees" the surface, because it owns it (otherwise it turns into a memory leak).
Cheers, and good luck!
Note: Double underscores in the front of an identifier are a big no-no - they are reserved for the compiler and preprocessor. Instead, go with something like this:
#ifndef HEADER_NAME_H#define HEADER_NAME_H...#endif /* HEADER_NAME_H */