GCO4020/CSC428 - Advanced Object Oriented Techniques In C++
Week 5
Value class stores string values in a
separate data member (myVal_String) rather than in the PolyType union
(myVal).
There is a sample solution for Exercise 1.
Value.
There is a sample solution for Exercise 2.
ValueLet::convertToBool() does not (need to) take a
ValueLet*& as a parameter.
There is a sample solution for Exercise 3.
ValueLet::assign(), is is necessary to delete
letter_ref before reassigning it. Suggest any restrictions this
deletion places on the way assign() is written.
There is a sample solution for Exercise 4.
complex<double>:
Value
ValueEnv
There is a sample solution for Exercise 5.
ValueEnv envelope and its various letter classes:
ValueEnv v1(true); ValueEnv v2("cat");
v2 += ++v1;
ValueEnv v3(3); ValueEnv v4(4.4);
v3 += v4;
There is a sample solution for Exercise 6.
Null helper class is needed. That is, explain why it is not
possible to simply use ValueType<void> as the "null" letter type.
There is a sample solution for Exercise 7.
ValueType::Val() member function was introduced to avoid the need
for universal friendship between the various interacting specializations¤ of
ValueType. Describe how such a mutual friendship
could be established between every possible ValueType<T> class.
There is a sample solution for Exercise 8.
There is a sample solution for Exercise 9.
ValueType letter class, describe
the steps that would now be required to add to the ValueEnv class the
capacity to store objects of the STL¤ class complex<double>.
There is a sample solution for Exercise 10.
ValueEnv class to store values of any
type (without additional coding for each type).
There is a sample solution for Exercise 11.
Last updated: Fri Feb 18 11:17:41 2000