#include #include "EntryVisitor.h" #include "GroupEntry.h" #include "PersonEntry.h" GroupEntry::GroupEntry(std::string name) : Entry(name) {} void GroupEntry::print(std::string indent) const { // print group name std::cout << indent << "Group: " << getName() << '\n'; // Part 1: call print() on each group member (with increased indent level) for (auto p : _entries) { p->print(indent + " "); } } void GroupEntry::addEntry(const Entry &entry) { // Part 1: Add the entry to this group _entries.push_back(&entry); } void GroupEntry::accept(EntryVisitor &v) const { v.visit(*this); // pass visitor to my children for (auto p : _entries) { p->accept(v); } }