home *** CD-ROM | disk | FTP | other *** search
- /* ------------------------------------------------------ */
- /* CLASSLIBB.CPP */
- /* (c) 1990 Borland International */
- /* All rights reserved. */
- /* ------------------------------------------------------ */
- /* veröffentlicht in: DOS toolbox 2'92 */
- /* ------------------------------------------------------ */
-
- #include <strng.h>
- #include <list.h>
-
- int main() {
- String s1("string 1"), s2("string 2"), s3("string 3");
- List l;
-
- // New allocates space for a new String, then the copy
- // constructor copies s1 into it. When you new an object,
- // you must explicitly delete it to get the destructor to
- // clean up the memory, and then have it freed.
- // These new'ed objects will be deleted in the List
- // destructor.
-
- l.add(*(new String(s1)));
- l.add(*(new String(s2)));
- l.add(*(new String(s3)));
-
- ListIterator li = l;
- while (li != 0) {
- cout << (String &)((Object &)li) << endl;
- li++;
- }
- return 0;
- } // end of main()
- /* ------------------------------------------------------ */
- /* Ende von CLASSLIBB.CPP */
-
-