Once Upon a Time

In the world of Win32 and COM, there’s little support to organize code in logical units, resulting in a flat application programming interface (API). Although C++ has a notion of namespaces, lots of APIs originate from earlier times when the use of namespaces wasn’t part of the design philosophy for those APIs.

For example, Win32 is basically an API consisting of functions and some data types, with no object-oriented aspirations. All those functions live in a single “namespace,” and therefore it’s perfectly possible to run into situations where two functions with the same name will clash. Such a problem manifests itself at compile time because the compiler (and in C/C++, we should also mention the linker) can’t figure out what ...

Get C# 4.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.