为什么我可以在未定义的函数和类中使用双冒号,但不能在变量中使用??
例子:
#include <iostream>
using namespace std;
class Person{
public:
int age;
string name();
};
int Person::age = 10; //It outputs an error
string Person::name(){ //It doesn't
return "n";
}
Run Code Online (Sandbox Code Playgroud) c++ ×1