Class Hierarchies(Chapter 15 of The C++ Programming Language)
2010-08-08 14:39
886 查看
[1] Use ordinary multiple inheritance to express a union of features; [2] Use multiple inheritance to separate implementation details from an interface;[3] Use a virtual base to represent something common to some, but not all, classes in a hierarchy;[4] Avoid explicit type conversion (casts); [5] Use dynamic_cast where class hierarchy navigation is unavoidable; [6] Prefer dynamic_cast over typeid;[7] Prefer private to protected ;[8] Don’t declare data members protected; [9] If a class defines operator delete(), it should have a virtual destructor;[10] Don’t call virtual functions during construction or destruction;[11] Use explicit qualification for resolution of member names sparingly and preferably use it in overriding functions;
相关文章推荐
- Templates(Chapter 13 of The C++ Programming Language)
- Notes to the Reader(Chapter 1 of The C++ Programming Language)
- Expressions and Statements(Chapter 6 of The C++ Programming Language)
- A Tour of the Standard Library(Chapter 3 of The C++ Programming Language)
- Functions(Chapter 7 of The C++ Programming Language)
- Source Files and Programs(Chapter 9 of The C++ Programming Language)
- Exception Handling(Chapter 14 of The C++ Programming Language)
- A Tour of C++(Chapter 2 of The C++ Programming Language)
- Pointers, Arrays, and Structures(Chapter 5 of The C++ Programming Language)
- Namespaces and Exceptions(Chapter 8 of The C++ Programming Language)
- Library Organization and Containers(Chapter 16 of The C++ Programming Language)
- Operator Overloading(Chapter 11 of The C++ Programming Language)
- Derived Classes(Chapter 12 of The C++ Programming Language)
- Types and Declarations(Chapter 4 of The C++ Programming Language)
- Classes(Chapter 10 of The C++ Programming Language)
- The C++ Programming Language Chapter 3 ( 读书笔记)
- Stability of the C++ ABI: Evolution of a Programming Language
- 《The C++ Programming Language, special edition》第6章6.6节中的一道有趣习题ch6.6-15
- Selected solutions to exercise of "The C Programming Language" 2e (Part 7, End of Chapter 1)
- The C Programming Language——Exercise solutions of the chapter one (1st)