Original Post
I have a class which creates a surface from bitmap in the constructor (and frees that surface with the destructor). now of course since the surface is freed by the destructor i cannot assign an object of the class to another. how would i go about that? my best attempt is this: #include "SDL.h" #include "Maps.h" #include TileSet::TileSet(int w, int h, int tcount, char * bmp) : width(w), height(h), tilecount(tcount), bitmap(SDL_LoadBMP(bmp)) { } TileSet::~TileSet() {SDL_FreeSurface(bitmap);} TileSet & TileSet::operator=(const TileSet & rs) { if (this == &rs) return *this; //std::strcpy(label, rs.label); //rating = rs.rating; //SDL_BlitSurface(rs.bitmap, NULL, bitmap, NULL); bitmap = SDL_ConvertSurface(rs.bitmap, rs.bitmap->format, rs.bitmap->flags); width = rs.width; height = rs.height; tilecount = rs.tilecount; return *this; }