c++ - Question regarding inheritance in wxWidgets -


currently i'm attempting write own wxobject, , class based off of wxtextctrl class.

currently have:

class commandtextctrl : public wxtextctrl {     public:         void onkey(wxkeyevent& event);     private:         declare_event_table() }; 

then later on have line of code, doesn't like:

commandtextctrl *ctrl = new commandtextctrl(panel, wxid_any, *placeholder, *origin, *size); 

...and when attempt compile program receive error:

error: no matching function call ‘commandtextctrl::commandtextctrl(wxpanel*&, <anonymous enum>, const wxstring&, const wxpoint&, const wxsize&)’ 

it seems doesn't inherit constructor method wxtextctrl. happen know why doesn't inherit constructor?

thanks in advance help!

c++ not inherit constructors (you may thinking of python, does;-). class w/o explicitly declared ctors, commandtextctrl, in c++, has default , copy ctors supplied implicitly c++ rules.

so, need explicitly define ctor desired signature, "bounces back" base class's -- commandtextctrl(...): wxtextctrl(...) {} kind of syntax, of course.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -