Vector c++

Apr 6, 2020 at 7:14pm
I have program that contains Class Book and Class News.
I need to create a vector library in main program that should contain pointers to objects of the Book and News type. Does someone knows how can i start with this?
Last edited on Apr 6, 2020 at 7:15pm
Apr 7, 2020 at 9:21am
Hello amy119s,

You could start with http://www.cplusplus.com/reference/vector/vector/?kw=vector

Then there is https://www.learncpp.com/ chapter P or https://www.learncpp.com/cpp-tutorial/6-16-an-introduction-to-stdvector/

Your question poses more questions?

Do you have to use a vector of pointers? Is it required?

What does the class look like?

What code are you working with? And what have you done so far?

Are you new to vectors or so you have some experience?

Post what code you have so far. Right now I can only guess at what you have and what you can use or might need.

If the program reads a file include it or at least a good sample, say 5 to 10 records, so everyone will have the same information to work with.

Andy
Topic archived. No new replies allowed.