By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,562 Members | 1,282 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,562 IT Pros & Developers. It's quick & easy.

Accessing a Vector in a Vector and other vector questions

P: 1
Hello,

I have a class called "Station" defined. If I want a vector that will store Station objects, is this the right syntax to create it:
vector<Station*> stationList;

Does the following line give me a vector pointer called newStation?

Station* newStation = new Station(stationName, lineNumber);

Does the following line add the station that I have created to the vector?

stationList.push_back(*newSation);

How do I access a station in the vector?

stationList.at(i) ?

Say I have a vector in each station of type int. How do I access the elements in that integer vector?

stationList.at(i)->linksList.at(j) ?
Apr 3 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.