摘要: 在类中如果需要其他对象作为成员函数时,需要注意以下几点:1、 类中如果需要其他对象作为私有变量或者protected时,只能调用没有参数的构造函数例如:#include <iostream>using namespace std;class A{public: A(char *p) { des = new char[10]; strcpy(des, p); cout<<"OK2"<<endl; } A(){cout<<"BOK"<<endl;} void show() { cout<< 阅读全文
posted @ 2012-10-20 20:52 SA高处不胜寒 阅读(844) 评论(0) 推荐(0) 编辑