Solved

How do you do a forward declaration?

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

830 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