正在加载图片...
String& string : operator += String ob)i /连接 char x temp= ch /含存原串数组 curlen+= ob. curlen;/长度累加 ch= new char maxLen+1; if ch==NULL) cerr<<“ 存储分配错n”;exit(1);} strcpy( ch, temp ) /烤贝原串数组 strcat(ch, ob. ch ) 连接ob串数组 delete l temp; return thisString& String :: operator += ( String& ob ) { //串连接 char * temp = ch; //暂存原串数组 curLen += ob.curLen; //串长度累加 ch = new char [maxLen+1]; if ( ch == NULL ) { cerr << “存储分配错!\n ”; exit (1); } strcpy ( ch, temp ); //拷贝原串数组 strcat ( ch, ob.ch ); //连接ob串数组 delete [ ] temp; return *this; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有