I studied definitions and declarations in C. The concepts are mainly embodied in functions, that is, declarations only tell the compiler that there is such a thing that there is no specific operation to define functions, the definition is specific to what the function should do.
Then I got confused when I came to C ++ and C #. What should I say about the class? What should I say about the objects of the definition class and definition class? Then I searched the internet. To sum up.
Declaration declaration -- reference declaration referncing Declaration
Define definition -- Definition declaration defining Declaration
The main difference lies in the compilationProgramDeclaration is used to describe the meaning of each identifier, and does not have to be a prebucket for each identifier. The definition of a reserved bucket ).
My understanding:
1) Variables, functions, classes, and objects are all the same. As long as the reserved memory space is not used, it is a statement.
Functions and classes (including struct) can be said to have a name and no specific definition.
Variables and objects. In general, no space is opened when there is no declaration. For example, if the extern keyword is added to indicate that it is an external variable, it will not reserve space in this program, but it will be opened only when the corresponding file is compiled.
As you can understand, the external variables are defined in an external file. This document only tells me something like this.
2) Partition classification and object definition. The definition of a class is the definition of its own content (that is, what should we do to describe this class ). The definition of an object is the instantiation of a class (the address of the object is the name of the object in the memory of the class type ).