I have the Component
class implemented on my code and works fine
namespace GUI {
class Component: public sf::Drawable, public sf::Transformable, private sf::NonCopyable {
public:
//Variables
};
}
and also the book I'm studying asks me to implement another class called Container
in the GUI namespace
Container::Container(): mChildren(), mSelectedChild(-1) {
}
void Container::pack(Component::Ptr component) {
mChildren.push_back(component);
if (!hasSelection() && component -> isSelectable())
select(mChildren.size() - 1);
}
bool Container::isSelectable() const {
return false;
}
What I don't get is the way he is implementing the class, which is giving me the syntax error in the title of the post:
Error: mChildren is not a Nonstatic data member or a base class of class GUI::Container.
I tried the further code:
class Container {
Container::Container(): mChildren(), mSelectedChild(-1) {}
void Container::pack(Component::Ptr component) {
mChildren.push_back(component);
if (!hasSelection() && component -> isSelectable())
select(mChildren.size() - 1);
}
bool Container::isSelectable() const {
return false;
}
};
But I'm still getting syntax errors. What exactly is wrong and what should I read regarding this subject?
Note: I also read C++ guideline books but I didn't find the answer there cause I probably don't know how to refer to this problem.