File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -9,22 +9,21 @@ In order to be considered "hiding", methods must have the same signature
99(i.e. the same name, same number of parameters, same parameter types, etc).
1010Only checks public, non-templated methods.
1111
12- The below example is bugprone because consumers of the `Derived ` class will
13- expect the `reset ` method to do the work of `Base::reset() ` in addition to extra
14- work required to reset the `Derived ` class. Common fixes include:
15- - Making the `reset ` method polymorphic
16- - Re-naming `Derived::reset ` if it's not meant to intersect with `Base::reset `
17- - Using `using Base::reset ` to change the access specifier
12+ The below example is bugprone because consumers of the `` Derived ` ` class will
13+ expect the `` reset `` method to do the work of `` Base::reset() ` ` in addition to extra
14+ work required to reset the `` Derived ` ` class. Common fixes include:
15+ - Making the `` reset ` ` method polymorphic
16+ - Re-naming `` Derived::reset `` if it's not meant to intersect with `` Base::reset ` `
17+ - Using `` using Base::reset ` ` to change the access specifier
1818
1919This is also a violation of the Liskov Substitution Principle.
2020
2121.. code-block :: c++
2222
23- class Base {
23+ struct Base {
2424 void reset() {/* reset the base class */};
2525 };
2626
27- class Derived : public Base {
28- public:
27+ struct Derived : public Base {
2928 void reset() {/* reset the derived class, but not the base class */};
3029 };
You can’t perform that action at this time.
0 commit comments