Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do you do a forward declaration?

Posted on 2000-04-09
4
Medium Priority
?
184 Views
Last Modified: 2010-04-02

//  How do I make this compile?

class Link {          
public:
  const Read *neighbor ;  
};


class Read {  
private:
public:
  vector<Link> left_exts ;
}
0
Comment
Question by:klopter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Accepted Solution

by:
captainkirk earned 200 total points
ID: 2697985

// this line would go before class Link
class Read;
0
 
LVL 22

Expert Comment

by:nietod
ID: 2698031
Spock to Enterprise, Captain Kirk you should answer,
0
 
LVL 1

Expert Comment

by:pepenieto
ID: 2699571
As Captain Kirk answer, this should compile perfectly:

class Read;

class Link {            
public:
  const Read *neighbor ;  
};


class Read {  
private:
public:
  vector<Link> left_exts ;
};
0
 

Author Comment

by:klopter
ID: 2700029
Thanks,
  Ken
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question