27.5 — Exceptions, classes, and inheritance

Exceptions and member functions Up to this point in the tutorial, you’ve only seen exceptions used in non-member functions. However, exceptions are equally useful in member functions, and even more so in overloaded operators. Consider the following overloaded [] operator as part of a simple integer array class: int& IntArray::operator[](const …

26.1 — Template classes

In a previous chapter, we covered function templates (), which allow us to generalize functions to work with many different data types. While this is a great start down the road to generalized programming, it doesn’t solve all of our problems. Let’s take a look at an example of one …