I have a strange error in my C ++ classes at the moment. I have an ActiveX wrapper class (as part of wxWidgets) to which I have added a new virtual function. I have another class that inherits from ActiveX (wxIEHtmlWin), however the ActiveX class always calls its own function instead of the one in wxIEHtmlWin that overrides it.
I canβt understand why this is happening. I made the function pure virtual, and now the program crashes when it makes a function call, but compiles otherwise. Is there a way to disable virtual functions or have I found an error in Visual Studio?
ActiveX class
protected: virtual FrameSite* getNewFrameSite()=0;
Class wxIEHtmlWin
class wxIEHtmlWin : public wxActiveX { protected: FrameSite* getNewFrameSite(); } FrameSite* wxIEHtmlWin::getNewFrameSite() { return new gcFrameSite(this); }
Edit: I added another test function (returns int) and still clamps.
Link to the code: http://lodle.net/public/iebrowser.rar
Edit:
OK, thanks to the answer below, I got it to work. What I did was create an activex class in two parts (for example, the one suggested), however in wxIEHtmlWin I named the second part of the constructor code. For example:
wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id, const wxPoint& pos,const wxSize& size,long style, const wxString& name) : wxActiveX() { wxActiveX::Create(parent, PROGID, id, pos, size, style, name); SetupBrowser(); }
Now I know why wxWidgets supports the construction of two parts.
c ++ visual-studio virtual wxwidgets
Lodle Dec 24 '08 at 8:04 2008-12-24 08:04
source share