Abstract
Suppose you’re working with a class your colleague wrote, and you want to extend that class’ functionality. How would you do it, without modifying the original code? Well, one approach is inheritance: you make a derived class, add the functionality you need, maybe even override something, and you’re good to go.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
The Null Object is described in Chapter Chapter 19 of this book. Essentially, a Null Object is an object that conforms to some interface, but has empty methods, that is, methods that do absolutely nothing. This solves the problem when you must supply an object into an API, but you don’t want that object to actually do anything.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2018 Dmitri Nesteruk
About this chapter
Cite this chapter
Nesteruk, D. (2018). Decorator. In: Design Patterns in Modern C++. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3603-1_9
Download citation
DOI: https://doi.org/10.1007/978-1-4842-3603-1_9
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3602-4
Online ISBN: 978-1-4842-3603-1
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books