Skip to content

Instantly share code, notes, and snippets.

@chancez
Created August 15, 2012 05:52
Show Gist options
  • Save chancez/3356616 to your computer and use it in GitHub Desktop.
Save chancez/3356616 to your computer and use it in GitHub Desktop.
#include "Skill.h"
#include "SkillNode.h"
#include <stdlib.h>
SkillNode::SkillNode(): children(NULL)
{
}
SkillNode::SkillNode(Skill& aSkill): skill(aSkill), children(NULL)
{
this->children = new SkillNode[MAX_CHILDREN];
}
void SkillNode::insert(SkillNode*& root, const Skill& aSkill)
{
if(root)
{
root = new SkillNode(aSkill);
// work around below..
// root = new SkillNode();
// root->skill = aSkill;
}
}
#ifndef SKILLNODE_H
#define SKILLNODE_H
#include "Skill.h"
class SkillNode
{
public:
SkillNode();
SkillNode(Skill& aSkill);
~SkillNode();
void insert(SkillNode*& root, const Skill& aSkill);
bool contains(SkillNode& root, char ch) const;
void display(ostream& out, SkillNode * root, int level) const;
private:
Skill skill;
SkillNode *children;
const int MAX_CHILDREN = 3;
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment