Lesson 3 of 5
Full String Class - Implementing All Five
Implementing a custom `String` class from scratch - owning `char*` data, null-terminated, with all five special members - is the canonical exercise for mastering the Rule of 5. Every C++ programmer should be able to write this. It tests memory ownership, const-correctness, operator overloading, exception safety, and noexcept move semantics simultaneously.
MyString - Complete Implementation with All 5 Specials
MyString - Complete Implementation with All 5 Specials
#include <iostream>
#include <cstring>
#include <algorithm>
#include <stdexcept>
#include <cassert>
class MyString {
char* data_; // always null-terminated, never null (empty = "