Advanced: Anonymous classes (C++)?

Started by
20 comments, last by Oluseyi 21 years, 9 months ago
quote:Original post by Fruny
That''s what the anonymous namespace is for.


It''s different.


  namespace{   Foo f;}class{private:   Foo f1;} Unnamed_class_instance;  


Using annoymous namespace, we (the client) can still access f.

But we cannot access f1 if it is inside the private section although the client can access Unnamed_class_instance.
Advertisement
Ok, I see your point.

Documents [ GDNet | MSDN | STL | OpenGL | Formats | RTFM | Asking Smart Questions ]
C++ Stuff [ MinGW | Loki | SDL | Boost. | STLport | FLTK | ACCU Recommended Books ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement