From 116d37c9ba6e9acfeaa075ac8c4d2a5c90ca551f Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Thu, 8 Sep 2016 14:47:05 -0400 Subject: [PATCH] Use 'override' rather than 'virtual' for overrides Minor change that makes this example more compliant with the C++ Core Guidelines. --- tests/test_virtual_functions.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_virtual_functions.cpp b/tests/test_virtual_functions.cpp index 0c01f53ac..1581d7400 100644 --- a/tests/test_virtual_functions.cpp +++ b/tests/test_virtual_functions.cpp @@ -36,7 +36,7 @@ class PyExampleVirt : public ExampleVirt { public: using ExampleVirt::ExampleVirt; /* Inherit constructors */ - virtual int run(int value) { + int run(int value) override { /* Generate wrapping code that enables native function overloading */ PYBIND11_OVERLOAD( int, /* Return type */ @@ -46,7 +46,7 @@ public: ); } - virtual bool run_bool() { + bool run_bool() override { PYBIND11_OVERLOAD_PURE( bool, /* Return type */ ExampleVirt, /* Parent class */ @@ -56,7 +56,7 @@ public: ); } - virtual void pure_virtual() { + void pure_virtual() override { PYBIND11_OVERLOAD_PURE( void, /* Return type */ ExampleVirt, /* Parent class */ @@ -107,11 +107,11 @@ public: }; class NCVirtTrampoline : public NCVirt { #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); } #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); } };