Note that there are some explanatory texts on larger screens.

plurals
  1. POWhen virtual doesn't work
    primarykey
    data
    text
    <p>I have a weird error in my C++ classes at the moment. I have an ActiveX wrapper class (as part of wxWidgets) that i added a new virtual function to. I have another class that inherits from the ActiveX one (wxIEHtmlWin) however the ActiveX class always calls its own function instead of the one in wxIEHtmlWin which overrides it.</p> <p>I can't work out why this is happening. I made the function pure virtual and now the program crashes when it does the function call but compiles fine otherwise. Is there any way to disable virtual functions or have I found a bug in Visual Studio?</p> <p>ActiveX class</p> <pre><code>protected: virtual FrameSite* getNewFrameSite()=0; </code></pre> <p>wxIEHtmlWin class</p> <pre><code>class wxIEHtmlWin : public wxActiveX { protected: FrameSite* getNewFrameSite(); } FrameSite* wxIEHtmlWin::getNewFrameSite() { return new gcFrameSite(this); } </code></pre> <p>Edit: I've added another test function (returns an int) and still screws up.</p> <p>Link to code in question: <a href="http://lodle.net/public/iebrowser.rar" rel="nofollow noreferrer">http://lodle.net/public/iebrowser.rar</a></p> <p>Edit:</p> <p>OK thanks to the answer below i got it to work. What i did was create the activex class in two parts (like suggested) however in wxIEHtmlWin i called the second part in the constructor code. Like so:</p> <pre><code>wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id, const wxPoint&amp; pos,const wxSize&amp; size,long style, const wxString&amp; name) : wxActiveX() { wxActiveX::Create(parent, PROGID, id, pos, size, style, name); SetupBrowser(); } </code></pre> <p>Now i know why wxWidgets supports two part construction.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload