From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: destroy_bitmap in destructor Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: <39e9f547_4 AT spamkiller DOT newsfeeds DOT com> <971687834 DOT 987432 AT shelley DOT paradise DOT net DOT nz> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 57 X-Trace: +4UIu4h52j+sWlSzPaOPYPR8otTk02cAci4tQi0u4NFORnGTRQ7gWgDXrexq/NNGc2VOJSivMpL6!Z9wPOak/9WiSLv2tsh4ODD15RQj/tI+9OkWI0LNw65IW1cjAkhITwovD2oEymjc4WsPlaipA7aF3!8NHRjg== X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Mon, 16 Oct 2000 20:44:29 GMT Distribution: world Date: Mon, 16 Oct 2000 20:44:29 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Mon, 16 Oct 2000 22:17:58 +1300, "Edmund Horner" wrote: >> struct CEnemy >> { >> short int ID; >> BITMAP *sprite; >> float x, >> y, >> xvel, >> yvel; >> bool hit, type; >> short int HP, life; >> >> CEnemy(int ID, int a, int b, int function); >> ~CEnemy(); >> >> void (*draw)(BITMAP *bitmap, CEnemy *e); // pointer to function that >> draws bullet >> bool (*routine)(CEnemy *e); // pointer to function for updating >bullet >> short int var1, var2, var3, var4; // uses depend on bullet type >> }; vector E(0); > >Since this is quite a complicated struct (constructors, functions, et. al.), >would it not be better calling it a class? In C++, class == struct except for the default access level of fields and methods. http://www.cpuniverse.com/archives/1999/mar/c++.html >> const int GTop = 500; >> const int GBot = 501; >> >> /* Prototypes for enemy behavior >> ********************************************/ >> bool Test(CEnemy *e); >> >> /* Constructor >> **************************************************************/ >> CEnemy::CEnemy(int ID, int a, int b, int function): >> x(a), y(b), life(0) >> { > >What this tells me is that your struct is descended from classes x, y, and >life, and you are calling those constructors! Not necessarily. See also http://msdn.microsoft.com/msdnmag/issues/0400/c/c0400.asp --