1st question is more about c++, but anyway:
I have this struct.
struct SCtrl:Ctrl{
void Paint(Draw& w)override{
...
}
};
Array<Ctrl> ctrls;
Array<SCtrl> sctrls;
ctrls.Create<Button>(); //this is ok
sctrls.Create<Button>(); //this produces error(no matching member function for call to 'Add')
Can the last one be done, so that SCtrl is somehow subclassed but still used as Ctrl to be used as Button,...?
You can only Create instances of classes that are derived from T. Button is descendant of Ctrl, but not SCtrl.
Quote:
Any idea how to do this properly? maybe provide copyCtor?