The String Class

In C++ there are two ways to process strings. C-Strings which are an array of characters terminated by a null character, or the C++ style string object. The string class hides the details of how the string is stored from the user – remember one of the tasks of a class is to abstract the…

Nested Lists

While it is not encountered all the time, any web developer who has worked very long will encounter a need for nested lists – that is a list within a list, or what is sometimes called a sub-list. Nested lists allow for you to better organize groups of related items. Consider a packing list for…

Data Field Encapsulation

Previously we looked at a class Circle, which had a property radius that was publicly available. That means that any other class, or your main program could change that value. This is a problem for two reasons: First, that data could be tampered with. Another function, class, etc could directly access the variable and change…