delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/07/09:30:17

From: Michiel Uitdehaag <m DOT uitdehaag AT imn DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: Simple pointer problem
Date: Mon, 07 Sep 1998 15:01:42 +0200
Organization: World Online
Lines: 32
Message-ID: <35F3D936.3F3DFD1E@imn.nl>
NNTP-Posting-Host: pc007.wkap.nl
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

  Hi,

I've got these objects of different classes that point at eachother like
this:
(first.h)
#ifndef first_h
#define first_h
#include "second.h"
class first {
private:
    second *pt;
};
#endif

(second.h)
#ifndef second_h
#define second_h
#include "first.h"
class second {
private:
    first *pt;
};
#endif

Well, this doesn't work, coz "second.h" needs "first.h" to compile, and
vice versa, or so it seems.
I know there's a standard trick around this, but my mind seems to be
rather foggy. Anybody out there with a proper solution?

Michiel Uitdehaag


- Raw text -


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