c++中用字符数组实现string,重写+、+=、()、<、==、>、[]运算符———全面的MyString
#include <iostream>
#include <cstring>
using namespace std;
class MyString {
// 在此处补充你的代码
size_t len;
char *str = nullptr;
public:
MyString(const char *s) {
if (s == nullptr)
return;
len = strlen(s)
原创
2021-02-24 21:00:33 ·
340 阅读 ·
1 评论