I was just introduced to this vector type, and i used it to return arrays of objects from functions. The objects have private values that can only be accessed trough functions. Thing is, i can't seem to call those functions like i did when i made arrays of those objects. My question is if i can call them from the vector type, and how if so?
This is my movie class. You can notice the values are private and are accessed trough getters, which both return strings.
I have another function that reads from a file and returns a vector of movie objects (* the rdmovies() function from the repository class). This is where i try to make use of that:
1 2 3 4 5 6 7 8 9
void controller::listmv()
{
vector <movie> movies;
movies = rp.rdmovies(); // * the said function is used here
for (int i=0; i<=movies.size(); i++)
{
cout << movies[i].getname() << movies[i].getdesc() << endl; // the error line
}
}
This seems fine in my head, but obviously, c++ doesn't agree. Hope you understand what i'm trying to do here and give me the piece of information i'm missing
It magically worked now, i think i mistyped something. Runs now but the output is a strange address. Back to running in depth bug hunting -_-. Thank you for your time!