C/C++ declaration definition

Variables and objects without extern are always defined, except those in classes.
Functions only have function headers for declarations and function bodies for definitions.
Classes are always only declarations. The function body of class member functions is defined.
class C
{
static int x;/ /Here x is the declaration
static const int a;;//Here a is the declaration
//Non-static variables are allocated memory when the class defines the object.
C();//The function here is the declaration
);

int C:: x;//This is the definition
const int C::a=11;//This is the definition

Guess you like

Origin blog.csdn.net/lgdlchshg/article/details/40822655