mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
C.129 Small fixes (#1406)
* C.129 Fix typos and conjugation I noticed some grammatical errors in this section and fixed them to match my interpretation of the author's intention. * One more fix Pluralization
This commit is contained in:
parent
6a6321fcbf
commit
0f57785d2b
|
@ -7086,10 +7086,10 @@ The importance of keeping the two kinds of inheritance increases
|
||||||
|
|
||||||
Problems:
|
Problems:
|
||||||
|
|
||||||
* As the hierarchy grows and more data is added to `Shape`, the constructors gets harder to write and maintain.
|
* As the hierarchy grows and more data is added to `Shape`, the constructors get harder to write and maintain.
|
||||||
* Why calculate the center for the `Triangle`? we may never us it.
|
* Why calculate the center for the `Triangle`? we may never use it.
|
||||||
* Add a data member to `Shape` (e.g., drawing style or canvas)
|
* Add a data member to `Shape` (e.g., drawing style or canvas)
|
||||||
and all derived classes and all users needs to be reviewed, possibly changes, and probably recompiled.
|
and all classes derived from `Shape` and all code using `Shape` will need to be reviewed, possibly changed, and probably recompiled.
|
||||||
|
|
||||||
The implementation of `Shape::move()` is an example of implementation inheritance:
|
The implementation of `Shape::move()` is an example of implementation inheritance:
|
||||||
we have defined `move()` once and for all for all derived classes.
|
we have defined `move()` once and for all for all derived classes.
|
||||||
|
@ -7113,7 +7113,7 @@ This Shape hierarchy can be rewritten using interface inheritance:
|
||||||
// ...
|
// ...
|
||||||
};
|
};
|
||||||
|
|
||||||
Note that a pure interface rarely have constructors: there is nothing to construct.
|
Note that a pure interface rarely has constructors: there is nothing to construct.
|
||||||
|
|
||||||
class Circle : public Shape {
|
class Circle : public Shape {
|
||||||
public:
|
public:
|
||||||
|
@ -7134,7 +7134,7 @@ For example, `center` has to be implemented by every class derived from `Shape`.
|
||||||
|
|
||||||
##### Example, dual hierarchy
|
##### Example, dual hierarchy
|
||||||
|
|
||||||
How can we gain the benefit of the stable hierarchies from implementation hierarchies and the benefit of implementation reuse from implementation inheritance.
|
How can we gain the benefit of stable hierarchies from implementation hierarchies and the benefit of implementation reuse from implementation inheritance?
|
||||||
One popular technique is dual hierarchies.
|
One popular technique is dual hierarchies.
|
||||||
There are many ways of implementing the idea of dual hierarchies; here, we use a multiple-inheritance variant.
|
There are many ways of implementing the idea of dual hierarchies; here, we use a multiple-inheritance variant.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user