J
jimjim
Hello all,
I ve started reading the C++ FAQ. I cannot understand the concept of section
7.5:
http://www.parashift.com/c++-faq-lite/classes-and-objects.html#faq-7.5
1. "In C, encapsulation was accomplished by making things static in a
compilation unit or module. "
I guess this refers only to static functions. As far as static variables are
concerned, they cannot be accessed by anywhere else apart from the
particular translation unit, unless declared as extern, right?
2. "By the way, static data at file-scope is now deprecated in C++: don't do
that"
Cant understand this!
3. What is the meaning of "Unfortunately this approach doesn't support
multiple instances of the data, since there is no direct support for making
multiple instances of a module's static data." Can you illustrate this point
with an example, please?
TIA
I ve started reading the C++ FAQ. I cannot understand the concept of section
7.5:
http://www.parashift.com/c++-faq-lite/classes-and-objects.html#faq-7.5
1. "In C, encapsulation was accomplished by making things static in a
compilation unit or module. "
I guess this refers only to static functions. As far as static variables are
concerned, they cannot be accessed by anywhere else apart from the
particular translation unit, unless declared as extern, right?
2. "By the way, static data at file-scope is now deprecated in C++: don't do
that"
Cant understand this!
3. What is the meaning of "Unfortunately this approach doesn't support
multiple instances of the data, since there is no direct support for making
multiple instances of a module's static data." Can you illustrate this point
with an example, please?
TIA