This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream> | |
| #include<cstring> | |
| //Implentation of String class with rule of three | |
| class String | |
| { | |
| public: | |
| String(const char* args) | |
| : data_(new char[std::strlen(args) + 1]), length_(std::strlen(args)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Copy-Constructor and assignment operator | |
| MyClass::MyClass() : /* Fill in initializer list. */ { | |
| /* Default initialization here. */ | |
| } | |
| //copy constructor | |
| MyClass::MyClass(const MyClass& other) { | |
| copyOther(other); | |
| } |
OlderNewer