public is a keyword for setting class access level to public (the other access levels are private and protected) or for public inheritance.
The public part of a class is called its interface.
A class created with the keyword class has a private access level by default, a class created by the keyword struct has public access level by default.
- Prefer public members for interfaces [2]
- Avoid public virtual member functions; prefer using the Template Method Design Pattern instead [1].
- Herb Sutter. Exceptional C++. ISBN: 0-201-61562-2. Item 23, page 84, guideline: 'Avoid public virtual functions; prefer using the Template Method pattern instead'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 20.7. Advice. page 611: '[11] Prefer public members for interfaces'