I have a base class called Panel, where some information about a window is stored, then, I have subclasses for all the controls: Button, Label etc. In the base class, I have the virtual void ApplySchemeSettings(Scheme* scheme) { }
method, which is called within the Panel(Panel* parent)
constructor. But instead of the subclass, the ApplySchemeSettings
from the base class (Panel
) is being called.
class Panel
{
[...]
public:
virtual void ApplySchemeSettings(Scheme* scheme) { };
Panel(Panel* parent)
{
[...]
this->ApplySchemeSettings(scheme());
};
}
class Frame : public Panel
{
[...]
public:
void ApplySchemeSettings(Scheme* scheme)
{
this->border = scheme->GetBorder("FrameBorder");
}
}
I can't declare ApplySchemeSettings
as abstract because the subclasses is made by user.