From 9dce5e5d878176dc0054ef381f5c6e705f43ef99 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 12 Nov 2020 13:45:58 -0500 Subject: [PATCH] Googletest export Use override instead of virtual for destructor https://google.github.io/styleguide/cppguide.html says: "Explicitly annotate overrides of virtual functions or virtual destructors with exactly one of an override or (less frequently) final specifier. Do not use virtual when declaring an override". The mocked class _should_ have a virtual destructor most of the times. PiperOrigin-RevId: 342082140 --- googlemock/docs/cook_book.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/docs/cook_book.md b/googlemock/docs/cook_book.md index 3033446e..c29d4c32 100644 --- a/googlemock/docs/cook_book.md +++ b/googlemock/docs/cook_book.md @@ -3078,7 +3078,7 @@ class MockFoo : public Foo { ... // Add the following two lines to the mock class. MOCK_METHOD(void, Die, ()); - virtual ~MockFoo() { Die(); } + ~MockFoo() override { Die(); } }; ```