delorie.com/archives/browse.cgi | search |
From: | "Paul Lutus" <nospam AT nosite DOT com> |
Newsgroups: | comp.lang.c++,comp.os.msdos.djgpp,comp.programming |
References: | <3720BE52 DOT 6E86A8C4 AT xoommail DOT com> <3720D21C DOT 9617323B AT atlantis DOT stortek DOT com> |
Subject: | Re: Question: Linked lists and classes: Self initiation |
Lines: | 64 |
X-Newsreader: | Microsoft Outlook Express 4.72.3110.5 |
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
Message-ID: | <4Z4U2.164$95.12096@news2.giganews.com> |
NNTP-Posting-Date: | Fri, 23 Apr 1999 15:44:48 CDT |
Organization: | Giganews.Com - Premium News Outsourcing |
X-Trace: | sv1-F8oYSLWiqWQAOhkSEIFar3zRxtQmrslnViok4eje78qDzP6eG/u9D09dEXuVyOADDH+wmN4629yYhmg!PV52LwoKgnEv |
X-Complaints-To: | abuse AT GigaNews DOT Com |
X-Abuse-Info: | Please be sure to forward a copy of ALL headers |
X-Abuse-Info: | Otherwise we will be unable to process your complaint properly |
Date: | Fri, 23 Apr 1999 13:44:45 -0700 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
<< I don't understand. How can initialization be recursive when initialization occurs once? >> << I don't see how your init function relates to a linked list. Is it creating another node? another list? inserting an element? >> This example may make it easier to follow. It is just a stunt, not a serious method: #include <iostream> class sillyStunt { public: sillyStunt(int lvl) { level = lvl; if(level < 16) { tab(level); cout << "Creating level " << level << endl; next = new sillyStunt(level+1); } else { next = NULL; } } ~sillyStunt() { if(next) { delete next; tab(level); cout << "Deleting level " << level << endl; } } void tab(int t) { while(t-- > 0) cout << ' '; } sillyStunt *next; int level; }; int main() { sillyStunt x(0); return 0; } -- Paul Lutus www.arachnoid.com Thomas Matthews wrote in message <3720D21C DOT 9617323B AT atlantis DOT stortek DOT com>... <snip>
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |