typedef int abc;
class Some{
public:
abc foo(){...}
typedef double abc;
};
在上面的代码中的参数列表里,我明白了,我得到一个错误:因为在这本书名称查找成员函数
error: changes meaning of 'abc' from 'typedef int abc'
C++底漆,第五edtion,它说:
Class definitions are processed in two phases:
1.First, the member declarations are compiled.
2.Function bodies are compiled only after the entire class has been seen.
但在这里的代码:
typedef int abc;
class Some{
public:
int foo(abc){...}
typedef double abc;
};
我在参数列表中设置了abc
。 但我没有得到那种错误,编译器工作得很好。 为什么后面的代码不会给我带来类似于前者的任何错误?
您的问题是? – Oswald 2013-03-20 13:56:10
我的不好。我编辑它。 – longtengaa 2013-03-20 14:04:14