Add wxOVERRIDE and use it in common and wxOSX code.

Make overriding virtual methods more explicit and enable additional checks
provided by C++11 compilers when "override" is used.

Closes #16100.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76173 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-03-20 13:26:28 +00:00
parent 34e4f66d6a
commit 33ad33d447
140 changed files with 865 additions and 718 deletions

View File

@@ -1686,6 +1686,33 @@ template <typename T> wxDELETEA(T*& array);
*/
#define wxEXPLICIT
/**
@c wxOVERRIDE expands to the C++11 @c override keyword if it's supported by
the compiler or nothing otherwise.
This macro is useful for writing code which may be compiled by both C++11
and non-C++11 compilers and still allow the use of @c override for the
former.
Example of using this macro:
@code
class MyApp : public wxApp {
public:
virtual bool OnInit() wxOVERRIDE;
// This would result in an error from a C++11 compiler as the
// method doesn't actually override the base class OnExit() due to
// a typo in its name.
//virtual int OnEzit() wxOVERRIDE;
};
@endcode
@header{wx/defs.h}
@since 3.1.0
*/
#define wxOVERRIDE
/**
GNU C++ compiler gives a warning for any class whose destructor is private
unless it has a friend. This warning may sometimes be useful but it doesn't