MCPcopy Create free account
hub / github.com/EricPengShuai/Interview / Color1

Class Color1

base_code/enum.cpp:32–40  ·  view source on GitHub ↗

* @brief 上述如果 using namespace Color 后,前缀还可以省去,使得代码简化。 * 不过,因为命名空间是可以随后被扩充内容的,所以它提供的作用域封闭性不高。 * 在大项目中,还是有可能不同人给不同的东西起同样的枚举类型名。 * 更“有效”的办法是用一个类或结构体来限定其作用域。 * * 定义新变量的方法和上面命名空间的相同。 * 不过这样就不用担心类在别处被修改内容。 * 这里用结构体而非类,一是因为本身希望这些常量可以公开访问, * 二是因为它只包含数据没有成员函数。 */

Source from the content-addressed store, hash-verified

30 * 二是因为它只包含数据没有成员函数。
31 */
32struct Color1
33{
34 enum Type
35 {
36 RED = 102,
37 YELLOW,
38 BLUE
39 };
40};
41
42/**
43 * @brief C++11的枚举类

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected