Skip to content

Commit 6eab855

Browse files
authored
Add example for C26434
1 parent 906f136 commit 6eab855

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/code-quality/c26434.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,21 @@ Introducing a function which has the same name as a non-virtual function in a ba
2525
## See also
2626

2727
[C.128: Virtual functions should specify exactly one of virtual, override, or final](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md)
28+
29+
# Example
30+
```
31+
struct Base
32+
{
33+
virtual void foo() = 0;
34+
};
35+
36+
struct Derived_1 : Base
37+
{
38+
virtual void foo() override {} // C26434, virtual is not needed here.
39+
};
40+
41+
struct Derived_2 : Base
42+
{
43+
void foo() override {}
44+
};
45+
```

0 commit comments

Comments
 (0)