// // This file contains the C++ code from Program 5.7 of // "Data Structures and Algorithms // with Object-Oriented Design Patterns in C++" // by Bruno R. Preiss. // // Copyright (c) 1998 by Bruno R. Preiss, P.Eng. All rights reserved. // // http://www.pads.uwaterloo.ca/Bruno.Preiss/books/opus4/programs/pgm05_07.cpp // template Wrapper::Wrapper () : datum () {} template Wrapper::Wrapper (T const& d) : datum (d) {} template Wrapper& Wrapper::operator = (T const& d) { datum = d; return *this; } template Wrapper::operator T const& () const { return datum; } template int Wrapper::CompareTo (Object const& obj) const { Wrapper const& arg = dynamic_cast const&> (obj); return ::Compare (datum, arg.datum); } template void Wrapper::Put (ostream& s) const { s << datum; }