面试C++试题[11]

[入库:2005年8月19日] [更新:2007年3月24日]

本文简介:选择自 x1001 的 blog

{

       delete [] m_data;

       m_data=0; //add by xie                       

// 由于m_data是内部数据类型,也可以写成 delete m_data;

//note by xie:有次去华为,华为批题,写成delete m_data;不给分,一个人的见识就是这样得来的,:p 

}

 

       // string的普通构造函数            

string::string(const char *str)      // 6

{

       if(str==null)                         

       {

              m_data = new char[1];    // 若能加 null 判断则更好

本文关键:C++,林锐,面试试题
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top