Re: forward declaration???


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by Dave Longley on April 22, 2001 at 16:28:22:

In Reply to: forward declaration??? posted by Heather on April 22, 2001 at 15:56:16:

You need to have two classes know about each other and possess data member instances of each other. Include one header file if needed, most likely in your ecosystem header, not both, that causes an error. To forward declare, just use this example:

FIRST HEADER FILE:
#include "foo2.h"

class foo2;

class foo1
{
foo2 *ptr;
}

SECOND HEADER FILE:

class foo1;

class foo2
{
foo1 *ptr
}


: Can anyone tell me more about foward declaration?
: or where I can read about it??? I don't recall ever hearing about it....if I use forward declaration of class1 in class 2, then must I include the class1.h in class2.cpp or something? cuz I am getting errors...
: (daiing...the project's due today and mine's not even compiling!!!!!!!!!!!!)
: Thanx ya all




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]