/* * mtree.cpp * * Created on: 28.11.2013 * Author: trifon */ #include "tree.h" #include "linked_list.cpp" class Employee { char name[100]; Employee* boss; // !!! Employee boss; }; template class MTree : public Tree > > { private: T data; LinkedList > subtrees; public: typedef LinkedListIterator > I; MTree(T _data = 0) : data(_data) {} MTree& addChild(MTree const& t) { subtrees.toEnd(t); return *this; } T root() const { return data; } I iterator() const { return subtrees.begin(); } }; template ostream& operator<<(ostream& os, MTree const& t) { os << '(' << t.root() << ' '; for(typename MTree::I it = t.iterator(); it; ++it) os << *it << ' '; return os << ')'; }