struct嵌套union
- 非匿名union
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char const *argv[]) {
struct People {
string name;
int age;
union Body {
int height;
int weight;
} body;
};
People people;
people.name = "williams";
people.age = 22;
people.body.height = 180;
cout <<