xml*_*lmx 2 c++ standards types class member-functions
struct A
{
void f1()
{
f2(); // ok, though f2() is not declared before
}
void f2()
{}
void f3(X*) // error: unknown type name 'X'
{}
struct X
{};
};
int main()
{
A a;
}
Run Code Online (Sandbox Code Playgroud)
为什么成员类型需要前向声明而成员函数不需要?
| 归档时间: |
|
| 查看次数: |
42 次 |
| 最近记录: |