Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!gatech!hubcap!ncrcae!ncr-sd!hp-sdd!hp-pcd!hplsla!jima From: jima@hplsla.HP.COM (Jim Adcock) Newsgroups: comp.lang.c++ Subject: Re: Some comments on Lippman's Message-ID: <6590238@hplsla.HP.COM> Date: 7 Sep 89 18:08:29 GMT References: Organization: HP Lake Stevens, WA Lines: 54 // >Grandi: No mention is made of the newly overloadable "," operator. It would // >be interesting to see cases in which it is useful. //---------------------------------------------------------------- //Quick example of using to make lists: #include // This list class is really bogus -- its just a quick example! class list { const char *s; const list *l; const list *r; public: list() {s=0; l=0; r=0;} list(const char *S){s=S; l=0; r=0;} list(const list& L, const list& R){s=0; l=&L; r=&R;} void print() const; list& operator,(const list& that){return *(new list(*this,that));} }; void list::print() const { if (l) l->print(); if (s) printf("%s ",s); if (r) r->print(); } void inline nextline(){putchar('\n');} void main() { list shoppinglist = ( (list) "apples", "oranges", "celery", "bananas", "bread", "newspaper" ); shoppinglist.print(); nextline(); ((list)"apples","oranges","celery","bananas","bread","newspaper").print(); nextline(); }