static variables?

So I'm just starting to get in to an oop style of programming.
I have had two major issues with this style and I'm hoping they are easy fixes.

1. The first is this. If I have a class, which I need to contain variables which will be used in callbacks (so they can't be constant), however I need them to have an initial value. I don't care whether they are static throughout all instances. Is this possible I thought I have heard people mention static variables, but putting static in front of the declaration of the variable in the class definition doesn't allow me to give it a value. Is there another way to do this?

2. is there a simple way to access variables in main from a class?
1.

With a C++ 11 compliant compiler, you can now just give them a default value in the class. Otherwise, use the constructor so that the variables are given a default value as soon as the class is created.

2.

Pass them into the class function as needed is the simplest.
btw, how to use static const type? i just know that you can only initialized class object's member with static const. and, what's the meaning of static const (because it seem a bit contradiction, a static and constant)?
Topic archived. No new replies allowed.