mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
improve code example, use() function makes little sense with void results of f() and g()
This commit is contained in:
parent
7c991f0e7e
commit
25e3ec4652
|
@ -15785,18 +15785,18 @@ Use the least-derived class that has the functionality you need.
|
||||||
|
|
||||||
class Base {
|
class Base {
|
||||||
public:
|
public:
|
||||||
void f();
|
Bar f();
|
||||||
void g();
|
Bar g();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Derived1 : public Base {
|
class Derived1 : public Base {
|
||||||
public:
|
public:
|
||||||
void h();
|
Bar h();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Derived2 : public Base {
|
class Derived2 : public Base {
|
||||||
public:
|
public:
|
||||||
void j();
|
Bar j();
|
||||||
};
|
};
|
||||||
|
|
||||||
// bad, unless there is a specific reason for limiting to Derived1 objects only
|
// bad, unless there is a specific reason for limiting to Derived1 objects only
|
||||||
|
|
Loading…
Reference in New Issue
Block a user