A namespace is like a place to put functions and classes, where their names won't conflict with functions and classes of the same name in different namespaces.
Code:
namespace one {
class c {};
}
namespace two {
class c {};
}
one::c x;
two::c y;
The preprocessor is a program that parses your source files before they are compiled. It handles lines that start with '#', such as #include and #define.
#include copies the entire contents of the included files into your source file. Often this is a header file containing function prototypes etc.
#define searches for one string and replaces it with another. That is,
Code:
#define color colour
will replace all occurences of "color" in your program with "colour" (outside of strings).
#defines can also be macros, like this:
Code:
#define square(x) ((x) * (x))
square(3)
// turns into
((3) * (3))
The extra parenthesis are in case something like "3+2" was passed as an argument. Without them it would turn into (3+2 * 3+2), which is something different. It's not perfect, though; passing something like "c++" would still mess it up: (c++ * c++). For this reason, inline functions are usually used instead of macros in C++.
Code:
inline int square(int x) { return x * x; }
They're just like regular functions except the compiler will make them "inline" if it can, eliminating the call and return assembly instructions. This is efficient for small functions but a bad idea for large ones. (The compiler can ignore this request if it likes and make the function a regular one.)
Functions declared inside a class are automatically inline.
Code:
class x {
void inline() {}
void notinline() {}
}
void x::notinline() {}
. . . okay I'll stop my rant before I go too far off topic.