【发布时间】:2016-03-12 15:17:12
【问题描述】:
为什么这段代码有效?看到 f 函数参数前面的 class 关键字了吗?如果我添加它会发生什么变化?
struct A
{
int i;
};
void f(class A pA) // why 'class' here?
{
cout << pA.i << endl;
}
int main()
{
A obj{7};
f(obj);
return 0;
}
【问题讨论】: