基本上這是關於最令人頭疼的解析的this question的後續。我可以理解這是由於函數聲明和變量定義之間的不明確性。爲什麼這不是一個令人煩惱的解析?
但在Comeau在線,我只是厭倦了以下。
class T{
public:
T(int i){
}
int fun1(){
return 1;
}
};
int main()
{
T myT(10); // I thought it'd be a function declaration that takes an int and returns a type T
myT.fun1(); // and a compiler error out here.
}
但它編譯得很好,沒有錯誤。我研究了標準文檔,但無法推理。
那麼,我在這裏錯過了什麼?
爲什麼你會想到什麼不同,你是正確的構建'T'的實例 – Nim 2011-05-08 08:15:08