< previous page
page_1039
next page >
Page 1039
#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?
#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.
DynArray x(100);
DynArray y(100);
What is the output of each of the following code segments?
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 >