20 lines
448 B
C++
20 lines
448 B
C++
|
#include <iostream>
|
||
|
|
||
|
#include "node.h"
|
||
|
|
||
|
node::~node() {
|
||
|
for (node *child : children) {
|
||
|
delete child;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
std::string node::get_name() const { return name; }
|
||
|
|
||
|
void node::set_name(const std::string new_name) { this->name = new_name; }
|
||
|
|
||
|
unsigned int node::get_nr_children() const { return children.size(); }
|
||
|
|
||
|
node *node::get_child(std::size_t i) const { return children[i]; }
|
||
|
|
||
|
void node::add_child(node *child) { children.push_back(child); }
|