Hi,
I'm trying to make a very simple program that declares a new type of class, that contains a vector. The idea is that I will be able to make objects of this class for different chat bots, that are just a name, and then a list of numbers.
Anyway, after scouring numerous forums I've been able to figure out how to declare the vector. But I can't figure out how to do anything with it. Based on my code (below), can someone give me some example code for how to:
1. put stuff into the vector inside the class.
2. access that stuff?
3. if I used a list of these objects, would I access them the same way?
None of the tutorials I've seen deal with using vectors inside a class, so I would really appreciate any help. Thanks.
Code:#include <iostream> #include <vector> using namespace std; class cretin { public: cretin() : d_v(3) {}; private: std::vector<int> d_v; vector<int>::iterator Iter; }; int main() { return 0; }



LinkBack URL
About LinkBacks



