Initialising a static data member of a Class? 
Author Message
 Initialising a static data member of a Class?

Hello there,
 I'm trying to initialise a data member in a C++ class that is
declared as static. This particular data member is a union:

class test {
public:
static union REGS regs;

Quote:
}

I know that to initialise the following.....

class test {
public:
static int temp;

Quote:
}

I add the following line at file scope:

int test::temp = 1;

but I have absolutly no idea how to do it with a union,
I've tried:

union test::regs = 1;
union test::regs.x.ax = 1;
union REGS test::regs.x.ax = 1;
union REGS test::regs = 1;
REGS union test::regs.x.ax = 1;

but none of them seem to work. Has anyone any idea of the
proper syntax?

Thanks in advance,
Bilbo



Mon, 26 Nov 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Initialising a static data member of a Class?

2. {OT} Initialising a static data member of a Class?

3. static data member of template class

4. Initialization of static data member of template class

5. Exporting class static data member from DLL( long )

6. problems with static data members of a class!

7. static class member data

8. does static class member change class size?

9. Class object as static member of another class

10. how to call a non-static member function of a class from a static member function of the class?

11. Exporting static data members in DLL problem

12. Exporting static data members to a DLL.

 

 
Powered by phpBB® Forum Software