Extending namespaces (C++ only)
Namespaces are extensible. You can add subsequent declarations
to a previously defined namespace. Extensions may appear in files
separate from or attached to the original namespace definition. For
example:
namespace X { // namespace definition
int a;
int b;
}
namespace X { // namespace extension
int c;
int d;
}
namespace Y { // equivalent to namespace X
int a;
int b;
int c;
int d;
}
In this example, namespace X is defined
with a and b and later extended
with c and d. namespace
X now contains all four members. You may also declare all
of the required members within one namespace. This method is represented
by namespace Y. This namespace contains a, b, c,
and d.