Solved

How do you do a forward declaration?

Posted on 2000-04-09
4
183 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 50 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

623 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