Files
cpp-course/modules/06_oop_basics/src/constructors.cpp
T

31 lines
737 B
C++
Raw Normal View History

2026-08-11 17:40:36 +03:00
#include "constructors.hpp"
namespace oop {
StringBuilder::StringBuilder(std::string initial) {
// TODO: Initialize buffer_ from initial
(void)initial;
}
StringBuilder::StringBuilder(const StringBuilder& other) : buffer_(other.buffer_) {}
auto StringBuilder::operator=(const StringBuilder& other) -> StringBuilder& {
if (this != &other) {
buffer_ = other.buffer_;
}
return *this;
}
void StringBuilder::append(const std::string& text) {
// TODO: Append all characters from text
(void)text;
}
auto StringBuilder::str() const -> std::string {
return std::string(buffer_.begin(), buffer_.end());
}
auto StringBuilder::size() const -> std::size_t { return buffer_.size(); }
} // namespace oop