This seminar, based on Scott's award-winning Effective C++, covers the most important
material that every professional C++ developer needs to know to be truly
effective with the language.
Course Highlights
Participants will gain:
- Mastery of the crucial member functions applicable to every class.
- Understanding of the resource acquisition is initialization
(RAII) technique for managing resources.
- Insights into the differences among member functions, non-member
functions, virtual functions, and non-virtual functions.
- Knowledge of the rules of thumb applied by expert programmers as they
design and implement software systems in C++.
Who Should Attend
Systems designers, programmers, and technical managers involved in the
design, implementation, and maintenance of software systems written in
C++. Participants should already know the basic features of C++ (e.g.,
classes, inheritance, virtual functions, templates), but expertise is not
required. People who have learned C++ recently, as well as people who have
been programming in C++ for some time, will come away from this seminar
with useful, practical, proven information.
Format
Lecture and question/answer. There are no hands-on exercises, but
participants are welcome to use their computers to experiment with the
course material as it is presented.
Length
One full day (six to seven lecture hours).
Detailed Topic Outline
- Fundamental Concepts and Functions:
- Use objects to manage resources
- Resource acquisition is initialization (RAII)
- std::auto_ptr
- std::tr1::shared_ptr
- TR1 and Boost
- Think carefully about copying behavior in resource-managing classes
- Know what functions C++ silently writes and calls
- Explicitly disallow use of implicitly generated member functions you
don't want:
- Declaring functions private
- Inheriting from a base class declaring them private
- Handle copying in classes with pointers:
- Handling the functions yourself
- Using resource-managing objects
- Make destructors virtual in base classes
- Virtual functions and object layout
- Strive for exception-safe code
- Definition of "exception-safe"
- The basic, strong, and nothrow guarantees
- Exception specifications and exception-safety guarantees
- Approaches to the strong guarantee
- Careful statement ordering
- Copy and swap
- Dependencies among exception-safety guarantees
- Overloading Operators:
- Handle assignment to self in operator=:
- The problem of aliasing
- Checking for assignment to self
- Using resource-managing objects
- Self-assignment and exception-safety
- Assign to all data members in operator=:
- Partial assignments
- The problem of inheritance
- The copy construction analogue
- Inheritance and Object-Oriented Design:
- Make sure public inheritance models "isa"
- Inheritance and intuition
- Runtime vs. compile-time error detection
- Inheritance and substitutability
- Differentiate between inheritance of interface and inheritance of
implementation:
- The meaning of pure virtual functions
- The meaning of "impure" virtual functions
- The meaning of nonvirtual functions
- Never redefine an inherited nonvirtual function
- Model "has-a" or "is-implemented-in-terms-of" through
containment
- Further Reading
For more information on this course, contact Scott directly.
|