From: hat AT se-46 DOT wpa DOT wtb DOT tue DOT nl (Albert Theo Hofkamp) Newsgroups: comp.os.msdos.djgpp Subject: Re: problem with list class Date: 9 Feb 1998 09:15:27 GMT Organization: Eindhoven University of Technology, The Netherlands Lines: 41 Message-ID: <6bmhff$d0s@tuegate.tue.nl> References: <34D1ADCD DOT 5CBB9988 AT sis DOT co DOT at> <34DB0C12 DOT 923FFFC9 AT sis DOT co DOT at> Reply-To: a DOT hofkamp AT wtb DOT tue DOT nl NNTP-Posting-Host: se-46.wpa.wtb.tue.nl Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <34DB0C12 DOT 923FFFC9 AT sis DOT co DOT at>, Gruber Gerhard writes: > DeHackEd wrote: > > This makes templates not as attractive as I thought first, because how > will I access template functions within a class when I have to define > the template funcitonality outside of it? You should differentiate between the class which is an element of the list, and the class containing the list itself. For a list windows, you'd do: class CWindow { ... }; // Define everything you want to do with a single // window here. typedef list CWindowList; // CWindowList is a list of windows. // All methods of CWindowList are defined in // the template. Note that appending a CWindow to the list makes a copy of that class using the copy-constructor. If that's not what you want, you can do class CWindowList: public list { ... } `list' is a list of pointers to windows. However, deleting the list will not delete the window objects, since pointers are not followed. (maybe list would, I have never tried that). if you derive a class CWindowList from the list, you can define your own destructor, and also define new methods (eg, counting the #windows which are opened). Albert --- Sorry, no .sig The sys admin wiped the previous sig, and I haven't invented a new one yet.