Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stroka::stroka(const char* S) :len(), pCh()
- {
- //strcpy_s(pCh, len + 1, S);
- len = 0;
- const char *cptr = S;
- while (*(cptr++) != '\0') len++;
- pCh = new char[len + 1];
- char *ptr1 = pCh;
- const char *ptr2 = S;
- for (int i = 0; i <= len; i++) {
- *ptr1 = *ptr2;
- ptr1++;
- ptr2++;
- }
- cout << "stroka::stroka(const char* S)" << endl;
- }
- stroka::stroka(const stroka& from) :len(), pCh()
- {
- len = 0;
- const char* cptr = from.pCh;
- while (*(cptr++) != '\0') len++;
- pCh = new char[len + 1];
- char* ptr1 = pCh;
- const char* ptr2 = from.pCh;
- for (int i = 0; i <= len; i++) {
- *ptr1 = *ptr2;
- ptr1++;
- ptr2++;
- }
- cout << "stroka::stroka(const stroka& from)" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement