delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/05/04:15:20

From: Dan <dyoon AT home DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: constructors + djgpp/allegro
Date: Thu, 05 Mar 1998 01:02:55 -0800
Organization: @Home Network
Lines: 42
Message-ID: <34FE6A3F.5C15@home.com>
Reply-To: dyoon AT home DOT com
NNTP-Posting-Host: cc104221-a.bnapk1.occa.home.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ok, I had a pretty strange thing happen in my program the other day.
I changed the way I constructed an object and this caused my program
to just hang.  Here are the two ways I constructed them...

//method one
//first i define some stuff up here...and then....
class myship
{
   int x, y;
   BITMAP* image;

   myship(int newX, int newY)
   {
      x = newX;
      y = newY;
      image = (BITMAP*)data[myship].dat;
   }
}

//method two  
class myship
{
   int x, y;
   BITMAP* image;

   myship(int newX, int newY) :
      x( newX ), y( newY ), image( (BITMAP*)data[myship].dat )
   { }
}

//////////////////////

Now the ONLY change in my source code that I make are these two 
constructors.  When I use method one, everything works fine, when
I use method 2, the program hangs, it seems to crash actually.

Does anyone know why this is?  It might help to know that the
graphics functions I am using are rotate_sprite() and blit().

Any help would be really appreciated.

Daniel Yoon

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019