#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
class MyStr {
int length{ 0 };
char* buff{ nullptr };
public:
MyStr() : length(0), buff(nullptr) {
cout << " MyStr default constr.\n";
}
MyStr(const char* init_val) {
if (init_val == nullptr) {
length = 0;
buff = nullptr;
cout << "строка введена 0";
}
else {
length = strlen(init_val);
buff = new char[length + 1];
strcpy(buff, init_val);
}
cout << " MyStr( char * ) constr.\n";
}
MyStr(const MyStr& other) {
}
~MyStr() {
cout << " MyStr destr.\n";
delete[] buff;
}
int size() { return length; }
MyStr& operator= (const MyStr& other) {
return *this;
}
friend MyStr operator+(const MyStr& s1, const MyStr& s2);
friend ostream& operator<< (ostream&, const MyStr&);
char& operator[] (int index) {
return buff[index];
}
};
MyStr operator+(const MyStr& s1, const MyStr& s2) {
MyStr res;
return res;
}
ostream& operator<< (ostream& os, const MyStr& s) {
return os;
}
int main() {
MyStr a;
MyStr b = "World!";
/*///////////////
MyStr c = a;
///////////////
MyStr c2;
c2 = a;
///////////////
c = a + b;
cout << c << endl;
*/
return 0;
}