P
Phlip
JoeC said:graphic::graphic(const graphic& gr){
ud = lr = 16;
assert(this != & gr);
//gdata = gr.gdata; <-- This crashes
Are you sure you are not assigning to yourself?
JoeC said:graphic::graphic(const graphic& gr){
ud = lr = 16;
//gdata = gr.gdata; <-- This crashes
JoeC said:Thanks for the time in explaining how that works.
That helped, ithink my graphic object is much better but it still
crashes at this point:
graphic::graphic(const graphic& gr){
ud = lr = 16;
//gdata = gr.gdata; <-- This crashes
BITMAP bitmap = {0,ud,lr,2,1,1};
bitmap.bmBits = &gdata[0];
hbitmap = CreateBitmapIndirect(&bitmap);
}
That bity of code crashes when I use the command like this:
if(play){
cgr = new graphic(play->gOut());
return *cgr;
--------------
graphic gOut() {return gr;}
It works if I coment out that part but I get a block instead of my
graphic, I think I am getting close.
Phlip said:assert(this != & gr);
Are you sure you are not assigning to yourself?
JoeC said:It is now I made the changes that were suggested. It does work better
if I take that statment out it just displays a block and don't copy the
graphic info. If I try to copy the program crashes.
JoeC said:Again thanks for the help. I thought this was more of a c++ problem.
If gdata = gr.gdata; copys the vector then it should work. I see no
reason why id dosn't.
I don't need to copy each element
or dop I need
to have a getter statment from gr object in the copy constructor.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.