随笔分类 - c++ 练习
摘要:1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 class TextBlock{ 6 public: 7 TextBlock(string x):text(x){ 8 } 9 //operator[] for co
阅读全文
摘要:例一: 1 #include<iostream> 2 using namespace std; 3 class numbered{ 4 private: 5 static int seq; 6 public: 7 numbered(){ mysn = seq++;} 8 int mysn; 9 };
阅读全文
摘要:直接管理内存:使用new和delete 1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 5 vector<int>* new_vector(){ 6 //分配失败new会返回一个空指针 7 return new (no
阅读全文

浙公网安备 33010602011771号