< previous page page_1039 next page >

Page 1039
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
#include testclass.h
#include <iostream.h>

int main()
{
    int       count;
    TestClass anObject(5);

    for (count = 1; count <= 3; count++)
        anObject.Write();
    return 0;
}
11. Given the TestClass class of Exercise 10, what is the output of the following program?
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
#include testclass.h
#include <iostream.h>

int main()
{
    int count;

    for (count = 1; count <= 3; count++)
    {
        TestClass anObject(count);
        anObject.Write();
    }
    return 0;
}
12. Let x and y be class objects of the DynArray class developed in this chapter.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
DynArray x(100);
DynArray y(100);
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
What is the output of each of the following code segments?
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
a. x.Store(425, 10);
   y.CopyFrom(x);
   x.Store(250, 10);
   cout << x.ValueAt(10) << endl;
   cout << y.ValueAt(10) << endl;
b. x.Store(425, 10);
   y = x;
   x.Store(250, 10);
   cout << x.ValueAt(10) << endl;
   cout  << y.ValueAt(10) << endl;

 
< previous page page_1039 next page >