Search code examples
visual-c++mfccode-analysis

Warning C26435 Function CXxxx::DoDataExchange should specify exactly one of `virtual`, `override`, or `final` (c.128)


Here is another code analysis warning:

Warning C26435 Function CAssignSelectedColumnDlg::DoDataExchange should specify exactly one of virtual, override, or final (c.128).

Example (boilerplate MFC code):

void CAssignSelectedColumnDlg::DoDataExchange(CDataExchange* pDX)
{
...
...
}

If I understand the documentation correctly, I need to attach either:

  • override or
  • final

... to the function declaration in the header?


Solution

  • Yes. The link you posted has another link in it:

    https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-override

    You can trust the authors :)

    Editors:

    Bjarne Stroustrup
    Herb Sutter
    

    For others benefit:

    void DoDataExchange(CDataExchange* pDX) final;