Is there a cleaner way to call a class's constructor when declaring a class derived from it without having to redeclare all its parameters?
So far this is the most suitable solution I've figured out:
As opposed to:Code:class Widget Widget(int x, int y, int w, int h) { ... } Widget(Widget* _Widget) { x = _Widget->x; ... } class w_Button:public Widget w_Button(string title, int type, Widget _Widget):Widget(_Widget) { ... }
This way, with c++0x I can just go:Code:w_Button(string title, int type, int _x, int _y, int _w, int _h):Widget(_x,_y,_w,_h) { ... }
So I guess I'm wondering if there's anything sneaky built into either c++ or c++0x that cuts out the need to make a temporary instance of the base class and send a second set of parameters directly to the base constructor.Code:new w_Button("Test", BUTTON_TEST, {10,10,32,10});
Or some other solution I'm completely overlooking.



LinkBack URL
About LinkBacks



