so with this class i have
public class Options
{
public bool show { get; set; }
public int lineWidth { get; set; }
public bool fill { get; set; }
public Color fillColour { get; set; }
public string options { get; set; }
public virtual void createOptions()
{
options += "show: " + show.ToString().ToLower();
options += ", lineWidth: " + lineWidth;
options += ", fill: " + fill.ToString().ToLower();
options += ", fillColor: " + (fillColour != Color.Empty ? ColourToHex(fillColour) : "null");
}
public Options(bool _show, int _lineWidth, bool _fill, Color _fillColour)
{
show = _show;
lineWidth = _lineWidth;
fill = _fill;
fillColour = _fillColour;
createOptions();
}
}
and another class that inherits it
public class Line : Options
{
public static bool steps { get; set; }
public override void createOptions()
{
options += ", lines: {";
options += " steps: " + steps.ToString().ToLower() + ",";
base.createOptions();
options += "}";
}
public Line(bool _show, int _lineWidth, bool _fill, Color _fillColour, bool _steps)
: base(_show, _lineWidth, _fill, _fillColour) { steps = _steps; }
}
When calling the object Line(true, 1, true, Color.Gray, true)
it does the override of the inherited class function first, then sets steps
to true
.
I want steps
to be included in the override so steps
will now be true
instead of false
(its default).
If its possible please gimme some pointers and tips on how to fix this and explain to me why my setup will not allow for the override to happen after the constructor init.