CO311: class safearray

This sequence of examples shows the development of a really useful set of member functions with a class that safely manages an array.

Example Number safearray.h driver.cpp Goal
1 Beginning case with an array as a data member, using put() and get() to work with the elements.
2 Another example that uses the basic version
3 Replace put() and get() with access() and its “return by reference” capability
4 2 versions of access(): one “regular” and one “constant”
5 Replace access() with operator[]
6 Another example using operator[]

 

Example Number safearray.h driver.cpp Goal
7 Putting count in the class and automating it.
8 Another example using the automatic count capacity.
9 Embedding maxsize in the class, eliminating a global variable.
10 Another example using the embedded maxsize.
11 Solving Practical #9 using a safearray