Please don't reprint this article; please don't re-publish this article in any form; please delete it within 24 hours of downloading this article; it is forbidden to use this article for commercial purposes.
3 Basic concepts [basic] 3.1 Declarations and definitions [basic.def] 3 [Basic concept] 3.1 Basic [Basic definitions and declarations. DEFINITIONS A declaration (clause 7) introduces names into a translation unit or redeclares names introduced by previous declarations. A Declaration Specifies The Interpretation and Attributes of these names. Declaration (Chapter 7) introduces the name to the translation unit or re-declares the name before the statement. The declaration specifies the interpretation and nature of these names. A declaration is a definition unless it declares a function without specifying the function's body (8.4), it contains the extern specifier (7.1.1) or a linkage-specification24) (7.5) and neither an initializer nor a function-body, it declares A Static Data Member In a class declaration (9.4), IT IS A Class Name Declaration (9.1), or it is a typedef dechannel (7.1.3), a using-declaration (7.3.3), or a useing-directive 7.3.4). The declaration is defined unless its declaration function is not specified in the function (8.4), which includes the extern qualifile (7.1.1) or connectivity specification 24) (7.5) but no initializer or function body, Declaring static data members in class declaration (9.4), which is a class name declaration (9.1), or it is a TypeDef declaration (7.1.3), use- Declaration (7.3.3), or USING-Directive (7.3.4) ).
[EXAMPLE: All But One of the Following Are Definitions: Int A; // Defines a Extern const INT C = 1; // Defines C INT F (INT X) {RETURN X A;} // defines f and defines x Struct s {int a; int b;}; // defines s, s :: a, and s :: b struct x {// defines x int x; // defines nonstatic data member x static int y; // declares Static Data Member Y x (): x (0) {} // defines a constructor of x}; int x :: y = 1; // defines x :: y enum {up, down}; // defines Up and Down namespace n {int D;} // defines n and n :: d namespace n1 = n; // defines n1 x ANX; // defines anx Whereas tres: // Declares a extern const INT c; // declares c int F (int); // Declares f struct s; // Declares s typedef int int; // declares int extern x anotherx; // declares anotherx using n :: d; // declares n :: d --end example] [Example: INT A ; // Define a extern const INT c = 1; // Define C INT F (INT X) {RETURN X A;} // Defining F and Define X Struct S {Int A; INT B;}; // Definition S, s :: a, and s :: b struct x {// definition x int x; // Define non-static data member x static int y; // Declare static data member y x (): x (0) { } // Define a constructor}; int x :: y = 1; // definition x :: y enum {up, down};
/ / Define Up and Down Namespace N {INT D;} // Definition N And N :: D Namespace N1 = n; // Defines N1 X ANX; // Defining ANX However, these are only declared: Extern Int a; // declaration a Extern const INT C; // Declaration C INT F (int); // Declaring F Struct S; // Declaring S TypeDef Int Int; // Declaration INTETERN X Anotherx; // Declaration Anotherx Using N :: D; / / statement N :: d - Example End] [Note: in some circumstances, C implementations implicitly define the default constructor (12.1), copy constructor (12.8), assignment operator (12.8), or destructor (12.4) member functions [. EXAMPLE: GIVEN STRUCT C {String S; // String Is The Standard Library Class (Clause 21)}; int Main () {c a; c b = a; b = a;} the importation will implicitly define functions to make the Definition of c {string s; C (): s () {} C (const C & X): s (xs) {} c & operator = (const c & x) {s = xs; return * this;} ~ c ()}}; End's "Note: In some cases, the C implementation implies the default configuration (12.1), replication construction (12.8), replication operator, or destructor (12.4) member function.