Straight from Wikipedia :
In general, a translation unit must contain no more than one definition of any type of class. In this example, two class definitions of type C occur in a single translation block. This usually happens if the header file is included twice in the same source file without the appropriate header protection.
class C {};
n the following, forming a pointer to S or definitions of a function that takes a reference to S, are examples of legal constructions because they do not require that type S be complete. Therefore, a definition is not required.
Defining an object of type S, a function that takes an argument of type S, or using S in a sizeof expression, examples of contexts where S should be and therefore require a definition.
struct S; // declaration of S S * p; // ok, no definition required void f(S&); // ok, no definition required void f(S); // ok, no definition required S f(); // ok, no definition required S s; // error, definition required sizeof(S); // error, definition required
More than one definition
In some cases, there may be more than one type definition or pattern. A program consisting of several header files and source files usually have more than one type definition, but no more than one definition per translation block.
If the program contains several type definitions, then each definition should be equivalent.
Static Constant Data Member Definitions
In pre-standard C ++, all static data members need to define outside their class. However, during the C ++ Standardization Process, it was decided to remove this requirement for static constant integral elements. the purpose was to allow use, for example:
struct C { static const int N = 10; }; char data[C::N];
without defining a namespace scope for N.
However, the wording of the 1998 C ++ standard still required if a member was used in the program. This included a member that appears anywhere except the sizeof or typeid operand is effectively badly formed.
This was defined as a defect, and the wording was adjusted so that such a term should appear anywhere a constant expression is required without requiring an extra-curricular definition. This includes an array of borders, case expressions, static member initializers, and nontype template arguments.
struct C { static const int N = 10; static const int U = N;
However, using a static const-integral term anywhere other than an integral constant expression requires a definition
struct C { static const int N = 10; }; int main() { int i = C::N;
This requirement will be relaxed in the upcoming C ++ standard, colloquially called C ++ 0x.