From: Weiqi Gao Newsgroups: comp.os.msdos.djgpp Subject: Re: Pointer to class? (C++) Date: Sat, 16 Oct 1999 16:47:45 -0500 Organization: CRL Network Services Lines: 33 Message-ID: <3808F281.FB96BA57@a.crl.com> References: <7uafcr$98f$1 AT baker DOT cc DOT tut DOT fi> NNTP-Posting-Host: a116024.stl1.as.crl.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i586) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Forsberg Sakari wrote: > > Hi! > > I have an class X. I have made many object > which are of type X. for example > > X object1; > X object2; > X object3; > ... > > I'd like to declare an array of pointers that > point to those objects. > > so I do > > X *array_of_pointers[300]; > > How I connect those pointers to those objects? > > array_of_pointers[0] = &object1; > array_of_pointers[1] = &object2; > array_of_pointers[2] = &object3; > > don't work... You didn't say how they don't work, but my guess is that X lacks a public no-arg ctor! -- Weiqi Gao weiqigao AT a DOT crl DOT com