Почему я получаю эту ошибку? Я в растерянности ...
ошибка: запрос на член push_back
в v
, который имеет неклассный тип std::vector<Leaf, std::allocator<Leaf> >*
class Leaf
{
public:
// Variables
std::string *name;
// Methods
Leaf(){}
Leaf(std::string *s)
{
name = s;
}
};
class Branch
{
public:
// Variables
Branch::Branch *parent;
Branch::Branch *child;
std::vector<Leaf> *children;
std::string *name;
// Methods
Branch(std::string *s)
{
children = new std::vector<Leaf>;
name = s;
}
};
class Tree
{
public:
// Variables
Branch::Branch *current;
// Methods
Tree(string *name)
{
current = new Branch::Branch(name);
}
void addBranch(Branch::Branch *newBranch)
{
this->current->child = newBranch;
newBranch->parent = this->current;
}
void addLeaf(Leaf::Leaf *leaf)
{
std::vector<Leaf> *v = this->current->children;
v.push_back(leaf);
}
};