Chapter 16: More Design Patterns

This chapter presents design patterns from two categories: creational and structural.

16.1 Creational Patterns

By using patterns to manage object creation, we gain flexibility that makes it possible to choose or change the kinds of objects created or used at runtime and to manage object deletion, especially in large software systems. Proper management of the creation of objects is an essential part of managing the separation between layers of code and ensuring the proper disposal of objects at destruction time.

In C++, a factory is a program component, generally a class, that is responsible for creating objects. The idea of a factory is to separate object creation from object usage.

A factory class generally has ...

Get Introduction to Design Patterns in C++ with Qt, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.