91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7.64KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-02-01
  • 標簽:

資源簡介

自己動手寫一個String實例,可實現基本的讀寫,查找,比較等等功能

資源截圖

代碼片段和文件信息



#define?_CRT_SECURE_NO_WARNINGS
#define?_CRTDBG_MAP_ALLOC

#include?
#include
#include
#include???//用于檢測內存泄漏

#ifdef?_DEBUG
#ifndef?DBG_NEW
#define?DBG_NEW?new?(?_NORMAL_BLOCK??__FILE__??__LINE__?)
#define?new?DBG_NEW
#endif
#endif??//?_DEBUG

using?namespace?std;
class?MyString
{
public:
//默認無參構造
MyString();
//構造函數
MyString(int?len);
MyString(const?char*?s);
MyString(char?c?int?n);
MyString(const?MyString&?s);
//重載>>運算符只能在類外實現
friend?ostream&?operator<<(ostream&?os?MyString&?s);
//重載<<運算符只能在類外實現
friend??istream&?operator>>(istream&?is?MyString&?s);
//重載==運算符,類外實現
friend?bool?operator==(const?MyString&?s1?const?MyString&?s2);
//重載()運算符
MyString&?operator()(const?MyString&?str);
//重載=運算符
MyString?operator=(const?MyString&?str);
//重載+運算符
MyString?operator+(const?MyString&?str);
//重載[]運算符
char&?operator[](int?index);
//重載<運算符
bool?operator<(const?MyString&?str2);
//重載<=運算符
bool?operator<=(const?MyString&?str2);

評論

共有 條評論