// testing the implementation of class varArray // Mikhail Nesterenko // 4/01/2013 #include #include "vararray.h" void testfunc(varArray); // function to test pass-by-value for varArray int main(){ varArray a1; // testing regular member functions a1.addNumber(4); a1.addNumber(3); a1.addNumber(2); a1.addNumber(1); a1.output(); a1.removeNumber(2); a1.output(); varArray a2,a3; a3=a2=a1; // testing overloaded assignment a3=a3; // testing protection against self-assingment testfunc(a3); // testing copy constructor a3.output(); // if destructor is implemented correctly // this should print properly after testfunc completes } // tests pass-by-value for object of class varArray void testfunc(varArray va){ // copy constructor is invoked on "va" va.output(); } // destructor is invoked when "va" goes out of scope