...

View Full Version : C++ Struct



Serex
11-03-2004, 04:46 AM
Ok i now am just curious. I have a struct that adds certain attributes to an object. i was wodering if i could set them for 2 or more.



struct
{
bool bVisible;
GF1::Sprite* pSprite;
} m_block[MAX_BLOCKS];


struct
{
bool bVisible;
GF1::Sprite* pSprite;
} m_block[MAX_BLOCKS], m_menuBg; <----- such as that.


just wondering if its possible, would save me creating many structures.

edit: i think i answered my own question. feedback would be nice

Dr. Evil
11-03-2004, 09:07 AM
I'm not sure if you're talking about arrays of structs, or just multiple different structs. If it's the latter, you could make a typdef struct then just declare it multiple times afterwards. Something like:


typedef struct
{
bool bVisible;
GF1::Sprite* pSprite;
} M_MENUBG;

M_MENUBG menu1;
M_MENUBG menu2;
//etc...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum