delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/16/19:11:38

From: Forsberg Sakari <zacu AT cc DOT tut DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pointer to class? (C++)
Date: 16 Oct 1999 22:13:29 GMT
Organization: Tampere University of Technology
Lines: 36
Message-ID: <7uata9$ao0$1@baker.cc.tut.fi>
References: <7uafcr$98f$1 AT baker DOT cc DOT tut DOT fi> <3808F281 DOT FB96BA57 AT a DOT crl DOT com>
NNTP-Posting-Host: lehtori.cc.tut.fi
X-Trace: baker.cc.tut.fi 940112009 11008 130.230.10.20 (16 Oct 1999 22:13:29 GMT)
NNTP-Posting-Date: 16 Oct 1999 22:13:29 GMT
User-Agent: tin/pre-1.4-981225 ("Volcane") (UNIX) (OSF1/V4.0 (alpha))
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Weiqi Gao <weiqigao AT a DOT crl DOT com> wrote:
> 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!
What's that?

Sorry, my mistake. Those three last sentences were outside of function :-)

**      Sakari Forsberg zacu AT cc DOT tut DOT fi       **
** Information: finger zacu AT assari DOT cc DOT tut DOT fi **

- Raw text -


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