123456789
class Name { private: string *name; int num; public: Name(string n);
123456789101112131415161718192021222324252627
#include <string> #include <vector> class Name { private: std::string m_name; int m_num; public: Name(std::string n) { m_name = n; } }; int main() { std::vector<Name> namesCollection; namesCollection.push_back(Name("tom")); namesCollection.push_back(Name("dick")); namesCollection.push_back(Name("harry")); return 0; }
12345
namesCollection.push_back(Name("tom the guy")); namesCollection.push_back(Name("dick the dick")); namesCollection.push_back(Name("harry the potter"))
namesCollection[0]
namesCollection.at(0)