Hello,

I am going over the GoF Facade pattern and have a question regarding the
following line from the book (in the implementation section of the
Facade pattern):

"Making subsystem classes private would be useful, but few object-oriented
languages support it. Both C++ and Smalltalk
traditionally have had a global name space for classes. Recently, however,
the C++ standardization committee added name spaces to the language [Str94],
which will let you expose just the public subsystem classes."

I'm not quite sure how this works in C++.  How does one make a class private
by using a C++ namespace?  My understanding of C++ namespaces is that
they are used to avoid name clashes between various modules/packages of
code.  I am not aware of how to make a class "private" within a
namespace so that a client is prohibited from using it.  In my mind all the
client has to do is use the "using namespace X" and all classes in that
namespace are his to use using unqualified names.

Am I missing something here in this part of the pattern? In other words how
does one "expose just the public subsystems classes" using C++ namespaces?

Thanks in advance,
Bruce

Reply via email to