Содержание
- 2. Tagged class – instances come in two or more flavors; contain a tag field indicating the
- 4. Tagged classes: Bad readability Spend to much memory (contain fields belonging to other flavors) Fields can’t
- 5. A tagged class is just imitation of a class hierarchy Refactor tagged class into a hierarchy
- 7. Item 21: Use function objects to represent strategies
- 8. Function object is – An instance of a class that exports exactly one method performing operations
- 9. Concrete strategy Comparator is concrete strategy for comparison Typical concrete strategy classes are stateless: has no
- 10. Concrete strategy classes are often declared as anonymous classes Note that using an anonymous class will
- 11. Item 22: Favor static member classes over nonstatic
- 12. Nested classes Static member classes Nonstatic member classes Anonymous classes Local classes Inner classes
- 13. If you declare a member class that does not require access to an enclosing instance –
- 15. Скачать презентацию