class 初始化没有匹配的构造函数
No matching constructor for class initialization
我有这个 class :
class instaStalkPanel : public wxPanel {
private:
public:
instaStalkPanel(wxWindow *parent, wxWindowID id, wxPoint &pos, wxSize &size, long style, const wxString &name);
wxDECLARE_EVENT_TABLE();
};
现在我正在尝试初始化这个 class 的指针变量,在另一个名为 instaStalkFrame 的 class 中:
mainPanel = new instaStalkPanel(this, ID_PANEL_MAIN, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, "panel");
它给我的错误:
No matching constructor for initialization of 'instaStalkPanel'
知道为什么会这样吗?
- 注:
构造函数:
instaStalkPanel::instaStalkPanel(wxWindow *parent, wxWindowID id, wxPoint &pos, wxSize &size, long style, const wxString &name) : wxPanel(parent, id, pos, size, style, name){
}
您正在尝试将非常量引用(pos
和 size
)绑定到 const 对象。
使参数 const wxPoint&
和 const wxSize&
.
我有这个 class :
class instaStalkPanel : public wxPanel {
private:
public:
instaStalkPanel(wxWindow *parent, wxWindowID id, wxPoint &pos, wxSize &size, long style, const wxString &name);
wxDECLARE_EVENT_TABLE();
};
现在我正在尝试初始化这个 class 的指针变量,在另一个名为 instaStalkFrame 的 class 中:
mainPanel = new instaStalkPanel(this, ID_PANEL_MAIN, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, "panel");
它给我的错误:
No matching constructor for initialization of 'instaStalkPanel'
知道为什么会这样吗?
- 注:
构造函数:
instaStalkPanel::instaStalkPanel(wxWindow *parent, wxWindowID id, wxPoint &pos, wxSize &size, long style, const wxString &name) : wxPanel(parent, id, pos, size, style, name){
}
您正在尝试将非常量引用(pos
和 size
)绑定到 const 对象。
使参数 const wxPoint&
和 const wxSize&
.