(C++) protected
February 24, 2017 · View on GitHub
(C++) protected
protected is a keyword to a class its access level to protected or for protected inheritance.
Examples
- protected example 1: a protected member variable (but note [2])
Advice
- Use protected members only carefully when really needed [1]
- Don't declare member variables protected [2]
References
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 20.7. Advice. page 611: '[12] Use protected members only carefully when really needed'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 20.7. Advice. page 611: '[13] Don't declare data members protected'