本文翻译自stackoverflow:http://stackoverflow.com/questions/7067793/what-is-this-crazy-c11-syntax-struct-bar-foo
首先先来看看普通的抽象用户定义类型(UDT):
struct foo { virtual void f() = 0; };
foo obj; // 不能定义一个 'obj' 变量为foo的抽象类型
struct foo { foo(){ cout << "i"; } };
struct foo { foo() { cout << "!"; } } instance;
struct { virtual void foo() = 0; } instance; //错误:不能声明一个'instance'的变量是抽象匿名结构<anonymous struct>类型
struct {} foo;
struct bar{}; //base UDT
struct : bar{} foo; //匿名派生UDT和实例
int x{0};
int x{};
struct : bar{} foo{}