static int age;
static int age = 10;
上面代码,在c中可以编译成功,但是在c++中,属于重复定义
a.cpp:14:12: error: redefinition of ‘int age’
static int age = 10;
^
a.cpp:13:12: error: ‘int age’ previously declared here
static int age;
^
static int age;
static int age = 10;
上面代码,在c中可以编译成功,但是在c++中,属于重复定义
a.cpp:14:12: error: redefinition of ‘int age’
static int age = 10;
^
a.cpp:13:12: error: ‘int age’ previously declared here
static int age;
^