Yasushi Shoji wrote:

> thank all of you who had replied to my question.
> i'd like to summarize my question and make sure
> i understand right.
> 
> case 1:
> if you declare static variable outsize of the class,
> that means the variable is global. so that, it is possible
> to access the static variable from outsize of a object.

Yes.

> case2:
> you should initialize(or define?) static variable
> outside of the class declaration.

A static member variable isn't part of any particular object
(instance), but is a global variable. Consequently, it has to belong
to a particular object file. This means that you have to define it at
the top level of some source file (as well as declaring it within the
class definition).

> case3:
> because, in my example, static variable is private,
> you need a static function if you want to access to
> that static variable without an object.

If the variable is private, then you can only access it from within a
member function of the class to which it belongs.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to