www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/23/14:55:48

Message-ID: <3720BE52.6E86A8C4@xoommail.com>
From: Ishpeck <ishpeck AT xoommail DOT com>
Organization: Lunaticnologies
X-Mailer: Mozilla 4.01 [en] (Win95; I)
MIME-Version: 1.0
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp,comp.programming
Subject: Question: Linked lists and classes: Self initiation
X-Priority: 3 (Normal)
X-Corel-MessageType: EMail
Lines: 18
NNTP-Posting-Host: 204.164.171.75
X-Trace: news6.ispnews.com 924892698 204.164.171.75 (Fri, 23 Apr 1999 14:38:18 EDT)
NNTP-Posting-Date: Fri, 23 Apr 1999 14:38:18 EDT
Date: Fri, 23 Apr 1999 12:39:14 -0600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Is it fezible to have a linked list initiate itself recursively?  I
think the best way to describe what I'm trying to say is put some
code up...

class fooclass {
  int number;
  char character;
  fooclass *next;
  public:
  void init(int setnum, char setchar, int quantity) {
    number = setnum;
    character = setchar;
    if(quantity>0){
      next = new(fooclass);
      next.init(setnum, setchar, quantity-1);
    }//end if     
  }//end init method
};//end class

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019