Commit 116d37c9 by Jason Rhinelander

Use 'override' rather than 'virtual' for overrides

Minor change that makes this example more compliant with the C++ Core
Guidelines.
parent 6eca083e
...@@ -36,7 +36,7 @@ class PyExampleVirt : public ExampleVirt { ...@@ -36,7 +36,7 @@ class PyExampleVirt : public ExampleVirt {
public: public:
using ExampleVirt::ExampleVirt; /* Inherit constructors */ using ExampleVirt::ExampleVirt; /* Inherit constructors */
virtual int run(int value) { int run(int value) override {
/* Generate wrapping code that enables native function overloading */ /* Generate wrapping code that enables native function overloading */
PYBIND11_OVERLOAD( PYBIND11_OVERLOAD(
int, /* Return type */ int, /* Return type */
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
); );
} }
virtual bool run_bool() { bool run_bool() override {
PYBIND11_OVERLOAD_PURE( PYBIND11_OVERLOAD_PURE(
bool, /* Return type */ bool, /* Return type */
ExampleVirt, /* Parent class */ ExampleVirt, /* Parent class */
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
); );
} }
virtual void pure_virtual() { void pure_virtual() override {
PYBIND11_OVERLOAD_PURE( PYBIND11_OVERLOAD_PURE(
void, /* Return type */ void, /* Return type */
ExampleVirt, /* Parent class */ ExampleVirt, /* Parent class */
...@@ -107,11 +107,11 @@ public: ...@@ -107,11 +107,11 @@ public:
}; };
class NCVirtTrampoline : public NCVirt { class NCVirtTrampoline : public NCVirt {
#if !defined(__INTEL_COMPILER) #if !defined(__INTEL_COMPILER)
virtual NonCopyable get_noncopyable(int a, int b) { NonCopyable get_noncopyable(int a, int b) override {
PYBIND11_OVERLOAD(NonCopyable, NCVirt, get_noncopyable, a, b); PYBIND11_OVERLOAD(NonCopyable, NCVirt, get_noncopyable, a, b);
} }
#endif #endif
virtual Movable get_movable(int a, int b) { Movable get_movable(int a, int b) override {
PYBIND11_OVERLOAD_PURE(Movable, NCVirt, get_movable, a, b); PYBIND11_OVERLOAD_PURE(Movable, NCVirt, get_movable, a, b);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment