mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
Use 'override' rather than 'virtual' for overrides
Minor change that makes this example more compliant with the C++ Core Guidelines.
This commit is contained in:
parent
6eca083e4c
commit
116d37c9ba
@ -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:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
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:
|
|||||||
};
|
};
|
||||||
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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user