Here's the output on the sample input. Like a good function, a good class is meant to be used more than once. Like a good function, a good class can have its internals modified without affecting its external interface. Container classes are classes that are made up of groups of objects of another class.
Container classes cry out for templates , but more on that later.
Functions defined outside a class can be made inline with the inline keyword. Thus, in most cases, classes really shouldn't have public member variables, because public member functions can be provided to access private member variables without loss of efficiency. Member functions may be private utility functions . To declare a constructor for a class, one must use a function with the same name as the class. As mentioned on page 150 of BS, all objects of a class with a constructor must be initialized, and all initializations must provide the constructor with all required arguments.