摘要: 1 #include 2 #include 3 4 using namespace std; 5 6 int main() 7 { 8 int *a = (int*)malloc(4); 9 a[0] = 4; 10 int *b = a; 11 12 free(b);//释放了b,a也就释放了 13 return 0; 1... 阅读全文
posted @ 2017-03-15 15:00 smile带着你 阅读(872) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 class Base 5 { 6 private: 7 int i; 8 protected: 9 int j; 10 public: 11 int k; 12 }; 13 class Child:public Base//对public继承 14 { 15 publi... 阅读全文
posted @ 2017-03-15 14:34 smile带着你 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 class Base 5 { 6 public: 7 Base() 8 { 9 cout << "base" << endl; 10 } //Base的构造函数 11 virtual ~Base() //Base的析构函数 ... 阅读全文
posted @ 2017-03-15 09:45 smile带着你 阅读(865) 评论(0) 推荐(0) 编辑