www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/20:34:09

From: "Chia" <chia AT top DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Easy C++ stuff... I hope, anyway.
Date: Wed, 28 Jan 1998 19:23:06 -0600
Organization: Home
Lines: 28
Message-ID: <6aolmn$3vs@nnrp3.farm.idt.net>
NNTP-Posting-Host: flex-36.top.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I've got two classes...  Both of them have lots of constructive arguments,
and I want to have one of them be contained from the other one.  Here's what
I mean:

class a {
public:
 a(int b) {
  x = b;
 }
protected:
 int x;
}

class b {
public:
 b(int x) {
  // normally, I would just do this:
  //  a class_a_instance(x);
  // but that doesn't seem to work.
  // any ideas on how to call class a's constructor
  // if it's part of another class?
  // thanks!  chia AT top DOT net
 }
protected:
 a class_a_instance;
}


- Raw text -


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