C++相談室 part44
■ このスレッドは過去ログ倉庫に格納されています
0481デフォルトの名無しさん
2005/10/29(土) 03:17:17一点目は残念ながら規格書ではないが。
プログラミング言語C++第3版 5.7 構造体(手持ちではP.141):
> Cの時代に遡る理由から、同じスコープに同じ名前のstructと非構造体を宣言することは可能になっている。
> たとえば、次の通り。
>
> struct stat { /* ... */ };
> int stat(char* name, struct stat* buf);
そして、規格書3.4 Name lookupの3:
> Because the name of a class is inserted in its class scope (clause 9), the name of a class is also
> considered a member of that class for the purposes of name hiding and lookup.
とあるので、class fooはfoo::fooとして参照できる。
よって、合法だと思う。
■ このスレッドは過去ログ倉庫に格納されています