String class
Posted by 천천히, 꾸준히
#include #include #include using namespace std; class MyString { char* string_content; // 문자열 데이터를 가리키는 포인터 int string_length; // 문자열 길이 int memory_capacity; // 현재 할당된 용량 public: MyString(char c); // 문자 하나로 생성 MyString(const char* str); // 문자열로 부터 생성 MyString(const MyString& str); // 복사 생성자 ~MyString(); // 소멸자 // 함수가 클래스의 멤버함수인 경우 const 키워드를 뒤에 삽입가능 // 이 경우 함수에 속해있는 객체의 멤버변수를 변경할 수 없다 int length..