Solved

How do you do a forward declaration?

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now