For my latest CS homework, I am required to create a class called Movie which holds title, director, year, rating, actors etc.
Then, I am required to read a file which contains a list of this info and store it in a vector of pointers to Movies.
I am not sure what the last line means. Does it mean, I read the file, create multiple Movie objects. Then make a vector of pointers where each element (pointer) points to one of those Movie objects?
Do I just make two vectors – one of pointers and one of Movies and make a one-to-one mapping of the two vectors?
It means something like this:
Then you add to the vector as you read lines:
Remember to delete all of the
Movie*objects once you are done with the vector.