标签:ini static 默认 std 类成员变量 全局变量 == nbsp ring
类成员变量:
char :? //随机
int :2685372 //随机
string :size:0length:0
vector :0
map :0
结构体 //取决于成员自己的类型
类成员静态变量: == 全局变量
char :
int :0
string :size:0length:0
vector :0
map :0
struct AAA1 { int i; char c[12]; }; class AAAA2 { public: static AAA1 aaa1; static std::string s; static std::vector<int> v; static std::map<int ,int> m; }; AAA1 AAAA2::aaa1; std::string AAAA2::s; std::vector<int> AAAA2::v; std::map<int ,int> AAAA2::m; TEST(INIT,INIT) { AAAA2 aaaa2[10]; for (int i = 0; i < 10; ++i) { std::cout << "char :" << AAAA2::aaa1.c[0] << std::endl; std::cout << "int :" << AAAA2::aaa1.i << std::endl; std::cout << "string :" << AAAA2::s << "size:"<< AAAA2::s.size() << "length:"<< AAAA2::s.length() << std::endl; std::cout << "vector :" << AAAA2::v.size() << std::endl; std::cout << "map :" << AAAA2::m.size() << std::endl; } }
标签:ini static 默认 std 类成员变量 全局变量 == nbsp ring
原文地址:https://www.cnblogs.com/aoyihuashao/p/9403551.html