I'm trying to understand the syntax of C++ since I'm almost fresh to the language, but I dont know what error exactly I'm facing..
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 Im 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 Non static data member or base class of class "GUI::Container"".
I tryed the futher 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 error =/ what exactly is going wrong and what shoul I read regarding this subject? (I also read C++ guidelines books but I didnt find the answer there cos I probably dont know how to refer to this problem) thanks in advance