home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
TUTORIAL
/
ICLCC
/
TUTOR6
/
EXAMPLE6.C
next >
Wrap
C/C++ Source or Header
|
1993-05-07
|
3KB
|
85 lines
/******************************************************************************/
/* */
/* COPYRIGHT: */
/* ---------- */
/* Copyright (C) International Business Machines Corp., 1991,1992. */
/* */
/* DISCLAIMER OF WARRANTIES: */
/* ------------------------- */
/* The following [enclosed] code is sample code created by IBM */
/* Corporation. This sample code is not part of any standard IBM product */
/* and is provided to you solely for the purpose of assisting you in the */
/* development of your applications. The code is provided "AS IS", */
/* without warranty of any kind. IBM shall not be liable for any damages */
/* arising out of your use of the sample code, even if they have been */
/* advised of the possibility of such damages. */
/* */
/******************************************************************************/
#include <tstring.h>
#include <iglobals.h>
#include <person.h>
#include <iset.h>
#include <irset.h>
typedef ISet <Person> PeopleSet;
typedef IRSet <Person, PeopleSet> PolyPeopleSet;
#include <ieqseq.h>
#include <irseq.h>
typedef IEqualitySequence <Person> People;
typedef IRSequence <Person, People> PolyPeopleSeq;
#include <itbseq.h>
typedef ITabularSequence <Person> PeopleTab;
typedef IRSequence <Person, PeopleTab> PolyPeopleTab;
class MyPrint: public IConstantIterator <Person> {
applyTo(Person const & person){
cout << "Name " << person.getName() << "\n" ;
return True;
}
};
void printCollection( ............ <......> const & collection){
....... myPrint;
collection..............(myPrint);
}
int main () {
People people;
people.add("J. Uhl");
people.add("K. Liegert");
people.add("M. Blum");
people.add("T. Wappler");
people.add("F. Seliger");
people.add("H. Wingert");
people.add("C. Ludwig");
people.add("Your Name");
people.remove("K. Liegert");
PeopleSet peopleSet;
peopleSet.add("Joe Cool");
peopleSet.add("Mr. Nobody");
peopleSet.remove("T. Wappler");
peopleSet.add("Mrs. Somebody");
printCollection(PolyPeopleSet(peopleSet));
printCollection(PolyPeopleSeq(people));
......... peopleTab;
PolyPeopleTab polyPeopleTab(peopleTab);
polyPeopleTab...........(.............(......));
polyPeopleTab.add("Your Name again");
printCollection(polyPeopleTab);
peopleTab.add(" yet another Joe Cool");
return 0;
}