www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/09/19:40:33

From: "Jay" <ok11 AT ihatespam DOT sprint DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Array of classes
Lines: 22
Organization: n/a
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <UPvP2.78092$Mb.32024858@newscontent-02.sprint.ca>
Date: Fri, 9 Apr 1999 16:12:50 +0100
NNTP-Posting-Host: 209.148.241.15
X-Complaints-To: abuse AT sprint DOT ca
X-Trace: newscontent-02.sprint.ca 923699572 209.148.241.15 (Fri, 09 Apr 1999 19:12:52 EDT)
NNTP-Posting-Date: Fri, 09 Apr 1999 19:12:52 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

OK, I have a question.  Suppose I have a class and a constructor that take 2
params. eg.

class MyClass
{
    public:
    MyClass(int,int);
    ...
};

I can decalre a class 'm' and initialize it like
MyClass m(0,0);

Now the problem is, say if I have an array of MyClass
MyClass m[100]
How can I call the constructor (using the same parameters) for each 100
elements without doing
MyClass m[100] = { MyClass(0,0), MyClass(0,0), ..........};




- Raw text -


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