class String
{
private:
char *str; //문자열을 지시하는 포인터
int len; //문자열의 길이
static int num_strings; //객체의 수
static const int CINLIM = 80; //cin 입력한계
public:
//생성자와 기타 메서드
String(const char *s); //생성자
String(); //디폴트 생성자
String(const String& st); // 복사생성자
~String();
int length() const { return len; }
//오버로딩 연산자 메서드
String& operator=(const String& st);
String& operator=(const char* s);
char& operator[](int i);
const char& operator[](int i) const;
//오버로딩 연산자 프렌드
friend bool operator<(const String&st1,const String& st2);
friend bool operator>(const String&st1,const String& st2);
friend bool operator==(const String&st1,const String& st2);
friend String operator+(const String& st1,const String& st2);
friend ostream& operator<<(ostream& os,const String& st);
friend istream& operator>>(istream& is,String& st);
void StringUp(); //대문자를 소문자로
void StringLow(); //소문자를 대문자로
int cntChar(char c);
//static 함수
static int HowMany();
};
String operator+(const String& st1,const String& st2)
{
return strcat(st1.str,st2.str);
}
int main()
{
String s1("Test the one");
String s2("You can't see me");
String s3 = s1 + s2;
//s3.cntChar('c');
cout<<s1;
cout<<s2;
//cout<<s3;
return 0;
String(strcat(st1.str,st2.str)) 로 쓰고 && 생성자
ro data 에 strcat 쓰는거 부터가 문제다
String(strcat(st1,str,st2.str)) 써봤는데 안되고 &&생성자는 정의하믄 안됩니다 ㅜㅜ 문제 조건에 없어여..
류센 // 형님 죄송한데 ro data가 뭔지 잘 모르겠습니다;
read only data, 근데 좆도 모르는데 왜 되도 안한 답변 다는거?
글쓴이 더러 한 말 아니니 괘념치 말고
ㅜㅜ;