delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/31/07:42:16.1

From: "A. Jans-Beken" <jansb000 AT wxs DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Initializing classes within classes...
Date: Thu, 31 Dec 1998 13:37:22 +0100
Organization: World Access
Lines: 24
Message-ID: <368B7001.4A2F86FA@wxs.nl>
NNTP-Posting-Host: vl0210-0.dial.wxs.nl
Mime-Version: 1.0
X-Trace: reader1.wxs.nl 915107720 21903 195.121.18.210 (31 Dec 1998 12:35:20 GMT)
X-Complaints-To: abuse AT wxs DOT nl
NNTP-Posting-Date: 31 Dec 1998 12:35:20 GMT
X-Mailer: Mozilla 4.04 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am wondering how to do this...

class BASIC {
   private: // Lots of variables here...
   public: BASIC( int a, int b); // Constructor ...
   };

class NOTSOBASIC {
   private:
      BASIC b1;
      BASIC b2;
      // Many other variables...
   public:
      NOTSOBASIC() { /* how to init b1 and b2? */ }
   };

The class "NOTSOBASIC" contains two BASIC items. However, the BASIC
items always must be constructed with two parameters. How must I program
the constructor of "NOTSOBASIC" so that b1 and b2 are correctly
initialized?

thanx.


- Raw text -


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