Mail Archives: djgpp/2000/10/16/17:00:21.2
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 -