【初心者歓迎】C/C++室 Ver.79【環境依存OK】
■ このスレッドは過去ログ倉庫に格納されています
0405デフォルトの名無しさん
2012/08/10(金) 15:07:07.17using Oya::age;
Kodomo() : age(50) {}
};
§12.6.2.2
Names in a mem-initializer-id are looked up in the scope of the constructor’s class and, if not
found in that scope, are looked up in the scope containing the constructor’s definition.
[Note: if the constructor’s class contains a member with the same name as a direct or virtual
base class of the class, a mem-initializer-id naming the member or base class and composed of
a single identifier refers to the class member. A meminitializer-id for the hidden base class may
be specified using a qualified name. ] Unless the meminitializer-id names a nonstatic data
member of the constructor’s class or a direct or virtual base of that class, the mem-initializer
is ill-formed. A mem-initializer-list can initialize a base class using any name that denotes
that base class type.
結局Oya::ageとKodomo::ageの区別が曖昧だからじゃね
■ このスレッドは過去ログ倉庫に格納されています