template 
\fbox{binary tree}
class tree { public: tree( tree* p, T& n ) : parent(p) { left = right = 0; node = n; } void insert( tree* t ) { require( t != 0 ); insert_node( t ); promise( invariant() ); } virtual bool invariant() { return ( left == 0 || left->parent == this ) && ( right == 0 || right->parent == this ); } protected: tree *left, *right, *parent; void insert_node(tree* t);
\c{// does the real work}
T& node; };

slide: Checking invariants