home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BURKS 2
/
BURKS_AUG97.ISO
/
BURKS
/
SOFTWARE
/
LIBS
/
NIHCL1.ZIP
/
NIHCL-3.0
/
EX
/
EX8-2.C
(
.txt
)
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-16
|
748b
|
30 lines
// ex8-2.c -- Use of an Iterator with container
// for objects of unknown class
// $Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/ex/RCS/ex8-2.c,v 3.0 90/05/15 22:46:14 kgorlen Rel $
#include "OrderedCltn.h"
#include "Iterator.h"
#include "String.h"
void listContainer(ostream& strm,Collection& cltn)
{
// Iterator knows neither
// the actual class of cltn nor
// the actual class of any Object in cltn
Iterator it(cltn);
while (it++) strm << *it() << " ";
}
main()
{
OrderedCltn symbols;
symbols.add(*new String("A"));
symbols.add(*new String("C"));
symbols.add(*new String("G"));
symbols.add(*new String("T"));
listContainer(cout,symbols);
cout << endl;
}