[comp.lang.c++] Static initialised class members

barry@bain3.oz (Barry Allebone) (08/16/90)

 I am an experienced programmer trying to learn C++.
 I have been writing object oriented style C code
 for about a year and partly as a training exercise
 I am trying to convert some of it to C++.  I am 
 having great difficulty with one element as follows.

 All my C classes declare a look-up table where each
 row (an LuRow) is int, char*, char*, int.  Each look-up
 table (or LuTab) is an initialised array of LuRows 
 containing information common to all instances of the
 class.  In C++ terms it seems to me that the tables 
 should be static class members.  However, although
 the documentation speaks of initialising static class
 objects I can't get it to work.

I am using the Zortech compiler version 2 with no options.
When I try to declare the static array of LuRows with
file scope the compiler complains. I've tried a
straightforward list of arguments and a list with LuRow
constructors but to no avail.  I note that the definition
with LuRow constructors works if the array is declared
with function scope e.g.  within main, but I get other
errors if I declare the array as a static class member.

In summary it seems that my problem is trying to declare a
static class member which is an initialised array of some
other class object.  Since this is trivial in C it must be
easy in C++ (???) so what am I not understanding ???

BTW although an avid reader of the net I have never posted
before to if this offends in any way please explain &
apologies in advance.

Barry Allebone, programmer, Meriband Pty. Ltd.
Sydney Australia