
\section{Appendix A}
\begin{verbatim}
// code to evaluate Prefix expressions. 
// the Pretty print functions are omitted.
// class definitions are in Section 2.
// code violates the Law of Demeter:
// it uses too many acquaintance classes

void Example::eval()
{  Prefix_list_it next_exp( *args );
// acquaintances: Prefix_list_it, Prefix.
   Prefix*          each_exp;
   while( each_exp = next_exp() )
      {  each_exp->pp();
	 cout << " = " 
	      << each_exp->eval();}}

int Prefix::eval() {}

int Compound::eval()
{ return oper->apply_op(args);}

int Number:eval()
{ return this->get_val();}

int Oper::apply_op(Prefix_list *args) {}

int MulSym::apply_op( Prefix_list *args )
// acquaintances: Prefix_list_it, Prefix.
{  Prefix_list_it next_exp( *args );
   Prefix*        each_arg;
   int         result = 1;
   while( each_arg = next_exp() )
      result *= each_arg->eval();
   return result;}

int AddSym::apply_op( Prefix_list *args )
// acquaintances: Prefix_list_it, Prefix.
{  Prefix_list_it next_exp( *args );
   Prefix*        each_arg;
   int         result = 0;
   while( each_arg = next_exp() )
      result += each_arg->eval();
   return result;}
\end{verbatim}

