delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/09/15:17:32

Message-Id: <m10AJZX-000S5LC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: "Jorge Ivan Meza Martinez" <jimeza AT usa DOT net>, djgpp AT delorie DOT com
Date: Tue, 9 Feb 1999 17:23:38 +0000
MIME-Version: 1.0
Subject: Re: a problem++ with classes inside others
In-reply-to: <000f01be545b$b2285f60$952c1ec8@enterprise-z>
X-mailer: Pegasus Mail for Windows (v2.54)
Reply-To: djgpp AT delorie DOT com

"Jorge Ivan Meza Martinez" <jimeza AT usa DOT net> wrote:

> I am trying to make a graph class, I must make two classes
> 
>     * graph nodes
>     * graph pathes ( relations between nodes )
> 
> a node has a value and an array of graph pathes, and,
> a node path has a weight and a pointer to a graph node.
> 
> I made both classes and in the headers I put:
> 
> "ifndef __GraphNode_h_
> #define __GraphNode_h_"
> 
> to prevent loop includes.
> 
> But I can't make this class - inside - other - than - has - a - reference -
> to - the - first work,
> compiler says that a class is not known in the other's class when the header
> is included and
> the source file is in the project.
> 
> Sorry if it is a little confused, if anyone can help me please tell me and
> I will send you my code, is very short for see my problem.

A mess ...
Let me see: You have:

class A
{
 ... reference to class B ...
};

class B
{
....reference to class A ...
};

problem? (the chiken and the egg ;-)
If that's your problem use 

class B;
class A
{
 ... reference to class B ...
};

In the header where class A is declared and:

class A;
class B
{
....reference to class A ...
};

In the header where class B is declared.

SET
------------------------------------ 0 --------------------------------
Visit my home page: http://welcome.to/SetSoft
or
http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org
ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013

- Raw text -


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