Notes, Tuesday, October 29


Previous page | Next page


The assignment operator and destructor for Assignment 4

The code is contained in ~karl/2270.fall02/ArithmeticExpressions/Expression.cxx.

Using constructors to achieve automatic type conversions

Look at the constructors in ~karl/2270.fall02/ArithmeticExpressions/constructors.cxx. Such conversions make other programming tasks much simpler. This is illustrated by a piece of a simplication function.

Conversions back and forth between strings and integers

Going from integers to strings and hence easily to expressions is shown in the constructor that does that work. The other direction is done like this:
return atoi (token.c_str ());

More examples of recursion

Recursion makes some seemingly difficult tasks quite easy:
  1. Drawing binary trees.
  2. Computing the derivative of an expression.
  3. Creating randomly balanced binary search trees.


Previous page | Next page | Back to top

3:40 PM, Thursday, December 12, 2002