Hi all,
Sorry for this, but it's driving me insane now, been at it for hours. Been searching the boards and google for similiar errors or even code examples of returning vectors, but not seeing anything similiar. Building on my last project of generating stars and planets, I decided to use a class to generate a vector filled with star names to associate with the stars I generated.
The problem I'm running into, is that I keep getting the compiler error " 'vector' does not name a type".
I realize(I think) that my problem is that the compiler is looking for a datatype to return from my method, but for the life of me I can't figure out what I should be placing there.
I'm guessing that it doesn't associate vector as a datatype, but rather a container, and wants to know what it contains. Is that right?
Anyways, the code I'm using is this...
If anyone could please toss me a hint how to return my vector?Code:#include <iostream> #include <vector> using namespace std; class Names { public: Names() { vector<string> name_getter; name_getter.push_back("Acrux"); name_getter.push_back("Alcor"); ........ name_getter.push_back("Yildun"); name_getter.push_back("Zosma"); } ~Names(); } vector Names :: getNames() { return name_getter; }
Again, any help is much appriciated, Hope I'm not being annoying.