Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String::String(const char znaki[])
- {
- n=strlen(znaki);
- this->znaki= new char[n+1];
- strcpy(this->znaki, znaki);
- printf("Dziala konstruktor dla slowa: %s\n", this->znaki);
- }
- String::String(const String &s)
- {
- this->n=s.n;
- this->znaki= new char[n+1];
- strcpy(this->znaki, s.znaki);
- printf("Dziala konstruktor kopiujacy dla slowa: %s\n", this->znaki);
- }
- void String::append(const char ch[])
- {
- n+=strlen(ch);
- char *z= new char[n+1];
- strcpy(z, this->znaki);
- strcat(z, ch);
- delete[] this->znaki;
- this->znaki = z;
- printf("Polaczony napis: %s\n", this->znaki);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement