C++ essentials 之 union

Extraction from The C++ Programming Language 4th. edition, Bjarne Stroustrup

  1. [8.1] A struct is a sequence of elements (called members) of arbitrary types. A union is a struct that holds the value of just one of its elements at any one time.
  2. A union is a struct in which all members are allocated at the same address so that the union occupies only as much space as its largest member. Naturally, a union can hold a value for only one member at a time.
posted @ 2016-09-09 17:59  Pat  阅读(157)  评论(0编辑  收藏  举报