Classes and inheritance

Hi
Iam running into a problem when using classes and inheritance.
I have a base class which contains a member function whos job it is to create and intialize some variables that are shared between other classes. The other classes are inherited from the base class and the variables are accessable from all the classes however i thought that when i called the member function from the base class at the begining of my program that the variables would still be initialised when i use them in other classes but this is obviously not the case , can somebody please set me straight on how to fix this problem , thanks.

haha i just did a bit of research on the net on using static variables with in classes and dirived classes and came up with the exact same code you just told me to use , works perfectly now . So just to clarify what you have told me and for anyone having this problem to, Narue correct me if iam wrong but because i had declared them as static variables within the base class i also needed to define them and because i wanted derived classes to use these variables i had to define them outside of the base class to override the scope of the variables. i hope this is correct

I probably need to work on my presentation of information but thankyou very much Narue , this forum is definately worth sticking on my favs!

and because i wanted derived classes to use these variables i had to define them outside of the base class to override the scope of the variables

That has nothing to do with scope. The visibility of your static members in derived classes will be determined by the access modifier (public, protected, or private). A definition is expected outside of the class for the compiler's benefit. Rather than require compilers to implement complex logic for ensuring that only a single definition of the member is created, that requirement is delegated to the programmer, who's in a position to do it properly and without difficulty.