// File: main2.C // // Testing the GenList, IntCell and StringCell classes #include #include #include #include "intcell.h" #include "stringcell.h" main() { GenList L ; int length ; IntCell *iptr ; StringCell *sptr ; ListCell *ptr ; L.append(IntCell(5)) ; L.append(StringCell("Hello")) ; L.append(StringCell("World")) ; L.append(IntCell(11)) ; L.print() ; cout << endl ; length = L.length() ; cout << "length = " << length << endl ; cout << endl ; IntCell x(5) ; L.remove(x) ; L.print() ; cout << "\n" << endl ; L.append(IntCell(17)) ; L.append(StringCell("foo")) ; L.print() ; cout << "\n" << endl ; ptr = L.chop() ; cout << "Removed item: " ; ptr->print() ; cout << endl ; L.print() ; cout << "\n" << endl ; delete ptr ; ListCell a; IntCell b ; StringCell c; cout << "ListCell id(): " << a.id() << endl ; cout << "IntCell id(): " << b.id() << endl ; cout << "StringCell id(): " << c.id() << endl ; }