Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of vector statement within a class?

Status
Not open for further replies.

acp32

Technical User
Nov 14, 2002
6
GB
My problem is that I cannot use the vector statement within a class. I would be grateful for any help.

To illustrate the problem:
If I open an application and generate a State class in the .h file as:
class State
{
};
After #include <vector> & using namespace std; are inserted I can use statements like:
vector<State*> StateList1;
in the form's code.
HOWEVER...
If I generate another class and declare a variable using vector I get errors, for example:
class StateList
{
private:
vector<State*> StateList2;
};
The errors are: Type name expeceted & declaration missing ;

Has anyone implemented the same thing trouble free?

AndyP
 
Where you have generated the class, have you forward declared State? Other than that, I cannot see any problems.
 
The code seems OK as long as class 'StateList' knows about / has access to, class 'State'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top