In C++, this optional keyword starts declaring the protected data members and/or member functions. The protected members of a class are moderately accessible by other program parts.

It is invoked thus:

class foo

protected data members
protected member functions


The protected section contains data members and member functions that are not accessible to the class instances and functions that do not belong to the class (such as the main() function). Typically, the protected section contains data members and auxiliary member functions (that is, member functions that work behind the secenes to help other member functions, especially the ones declared in the public section).