// skeleton.cpp #include #include #include class Person { std::string name; std::map attributes {}; public: Person(std::string name) { this->name = name; } Person* addAttribute(std::string key, std::string value) { this->attributes[key] = value; return this; } void greet() { std::cout << "Hello, my name is " << this->name << "!" << std::endl; for (auto& kv : this->attributes) { std::cout << " My " << kv.first << " is " << kv.second << "." << std::endl; } } }; int main(int argc, char* argv[]) { auto person = std::unique_ptr((new Person("Madison")) ->addAttribute("best friend", "Bob") ->addAttribute("favorite color", "pink") ); person->greet(); // Not necessary with unique_ptr: // delete person; return 0; }