© Will Briggs 2021
W. BriggsC++20 for Lazy Programmershttps://doi.org/10.1007/978-1-4842-6306-8_27

27. Esoterica (Not So Recommended)

Will Briggs1  
(1)
Lynchburg, VA, USA
 

I rarely use these features. Part of the reason for this chapter is for those rare circumstances in which they are useful. Another is understanding why they’re less popular. And because it’s fun to look ahead, there are sneak previews of two C++20 features that aren’t so useful yet, but should be in C++23: modules and coroutines.

protected sections, protected inheritance

Consider class Phone. Phone has a member numCalls_ which keeps track of all calls made, ever, by any Phone. There’s a function to change it, but it’s private, because we really should only update numCalls_ when making ...

Get C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners 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.