This website requires JavaScript.
Explore
Help
Register
Sign In
backup
/
CPlusPlusThings
Watch
1
Star
0
Fork
0
You've already forked CPlusPlusThings
mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced
2026-02-03 10:33:25 +08:00
Code
Issues
Projects
Releases
Wiki
Activity
Files
65c507d05cd30235df4d4c31cbeb61ea0bdb8b2b
CPlusPlusThings
/
basic_content
/
union
/
README.md
Light-City
8edbbbc5a2
update
2019-11-05 16:56:07 +08:00
696 B
Raw
Blame
History
Unescape
Escape
UNION那些事
关于作者:
个人公众号:
联合
(
union
)
是一种节省空间的特殊的类
,
一个 union 可以有多个数据成员,但是在任意时刻只有一个数据成员可以有值。当某个成员被赋值后其他成员变为未定义状态。联合有如下特点:
默认访问控制符为 public
可以含有构造函数、析构函数
不能含有引用类型的成员
不能继承自其他类,不能作为基类
不能含有虚函数
匿名 union 在定义所在作用域可直接访问 union 成员
匿名 union 不能包含 protected 成员或 private 成员
全局匿名联合必须是静态
(
static
)
的
Reference in New Issue
View Git Blame
Copy Permalink