www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/10/16/17:00:21.2

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: destroy_bitmap in destructor
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <mtpmusgvgu1tl3f7jdr8rp9c176ka9rgko@4ax.com>
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
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"
<ejrh AT paradise DOT net DOT nz> 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<CEnemy*> 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

-- 
<O
( \   GNOME vs. KDE: the game!
 X    http://pineight.8m.com/nes.htm

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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