Item 23. Exception-Safe Class Design, Part 2: Inheritance

I l @ ve RuBoard

Difficulty: 6

What does Is-Implemented-In-Terms-Of mean? It may surprise you to learn there are definite exception-safety consequences when choosing between inheritance and delegation . Can you spot them?

  1. What does Is-Implemented-In-Terms-Of mean?

  2. In C++, Is-Implemented-In-Terms-Of can be expressed by either nonpublic inheritance or by containment/delegation. That is, when writing a class T that is implemented in terms of a class U , the two main options are to inherit privately from U or to contain a U member object.

    Does the choice between these techniques have exception safety implications? Explain. (Ignore any issues not related to exception safety.)

I l @ ve RuBoard


More Exceptional C++
More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions
ISBN: 020170434X
EAN: 2147483647
Year: 2001
Pages: 118
Authors: Herb Sutter

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net