Øtemplate <class t> struct node; //forward declaration
Ø
Øclass poly {
Øpublic: enum Tag { I, P };
Øprivate:
Ø union { int i;
node<poly> * p; };
Ø Tag tag;
Ø void check(Tag t){ if
(tag!=t) error("bad");}
Øpublic:
Ø Tag get_tag() { return
tag; }
Ø int & ival() {
check(I); return i; }
Ø node<poly> * &
pval() { check(P); return p; }