ltj*_*jax 9 c++ inheritance name-lookup
这保证是有效的:
struct A
{
struct Gold {};
};
struct B : public A
{
typedef Gold BaseGold;
struct Gold {};
};
struct C : public B
{
typedef Gold BaseGold;
struct Gold {};
};
static_assert(is_same<B::BaseGold, A::Gold>::value, "Not the right treasure!");
static_assert(is_same<C::BaseGold, B::Gold>::value, "Not the right treasure!");
Run Code Online (Sandbox Code Playgroud)
它似乎适用于VS2010.显然它依赖于微妙的声明顺序/名称查找规则,所以我想知道标准在这个问题上说了什么......