#include #include // WARNING! THIS IS INCOMPLETE CODE! class arrayHolder { public: arrayHolder(unsigned int sz) { size = sz; array = new bool[sz]; } bool& operator[](unsigned int pos) { return array[pos]; } ~arrayHolder(void) { delete [] array; } private: bool * array; unsigned int size; }; // WARNING! THIS IS INCOMPLETE CODE! class twoer { public: int x; double y; // t is copied, not passed by reference. This is silly to do, but // it illustrates copying function arguments. friend ostream& operator<<(ostream& out, const twoer t) { return out << t.x << ' ' << t.y; } }; int main(void) { arrayHolder a(3); a[1] = true; a[2] = false; arrayHolder b(a); // Construct b by copying a. b[1] = false; arrayHolder c = b; // Construct c by copying b. a = b; // Change a to be same as b. a = a; // Copy a to itself. Silly but permissible. twoer t; t.x = 3; t.y = -2.3e-14; operator<<(cout, t); // Copy t as function argument. return EXIT_SUCCESS; }