O'Reilly logo

C++11 for Programmers, Second Edition by Harvey M. Deitel, Abbey Deitel, Paul J. Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.10.1. Using the Array Class

The program of Figs. 10.910.11 demonstrates class Array and its overloaded operators. First we walk through main (Fig. 10.9) and the program’s output, then we consider the class definition (Fig. 10.10) and each of its member-function definitions (Fig. 10.11).

 1   // Fig. 10.9: fig10_09.cpp 2   // Array class test program. 3   #include <iostream> 4   #include <stdexcept> 5   #include "Array.h"  6   using namespace std; 7  8   int main() 9   {10      Array integers1( 7 ); // seven-element Array   11      Array integers2; // 10-element Array by default 12 13      // print integers1 size and contents14      cout << "Size of Array integers1 is " 15         << integers1.getSize()16         << ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required