Currently I'm attempting to write my own wxObject, and I would like for the class to be based off of the wxTextCtrl class.
Currently this is what I have:
class CommandTextCtrl : public wxTextCtrl {
    public:
        void OnKey(wxKeyEvent& event);
    private:
        DECLARE_EVENT开发者_如何学C_TABLE()
};
Then later on I have this line of code, which is doesn't like:
CommandTextCtrl *ctrl = new CommandTextCtrl(panel, wxID_ANY, *placeholder, *origin, *size);
...and when I attempt to compile the program I receive this error:
error: no matching function for call to ‘CommandTextCtrl::CommandTextCtrl(wxPanel*&, <anonymous enum>, const wxString&, const wxPoint&, const wxSize&)’
It seems that it doesn't inherit the constructor method with wxTextCtrl. Does anyone happen to know why it doesn't inherit the constructor?
Thanks in advance for any help!
C++ does not inherit constructors (you may be thinking of Python, which does;-).  A class w/o explicitly declared ctors, like your CommandTextCtrl, in C++, only has default and copy ctors supplied implicitly by C++ rules.
So, you need to explicitly define a ctor with your desired signature, which basically "bounces back" to the base class's -- with the CommandTextCtrl(...): wxTextCtrl(...) {} kind of syntax, of course.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论