Namespaces

The C++ code in KDE2 makes extensive use of namespaces (especially in the kio, kjs, khtml, kfile, and kparts modules). A namespace can be thought of as nothing more than a standard prefix, or as a superclass. For example, the namespaces 'bar' and 'baz' could each have a class named 'foo' that refers to an entirely different object in each namespace. You distinguish between the two different 'foo' objects by prepending the namespace: 'baz.foo' or 'bar.foo'. If 'baz.foo' has a method 'fooMethod', you refer to it as 'baz.foo.fooMethod', while 'bar.foo' might have a method 'bar.foo.othermethod'. In this case, 'bar.foo.fooMethod' does not refer to an object that actually exists, since there is no 'foo.fooMethod' in the 'bar' namespace. C++ uses '::' instead of '.' as a separator, so 'bar::foo' in C++ is expressed as 'bar.foo' in Python.