Object Oriented Vectors

I am confused with how to use vectors in classes. For example if I have this header file

1
2
3
4
5
6
7
8
9
10
  class vectorsoo{
public:
  void addNumber(int);    // adds number to the array
  void removeNumber(int); // deletes the number from the array
  void output(void);  // prints the values of the array in sorted order

  int vectorSize(void)const{return container.size();}; // returns vector size

private:
  vector<int> container;


and then in main I try this:

1
2
3
4
5
vector<vectorsoo> vo;

int number;
cin >> number;
vo.addNumber(number);


it doesn't run, and says there is no member function addNumber. What am I doing wrong?
When you say, "says there is no member function addNumber", what exactly is it telling you?

Is it a compiler error, telling you that it doesn't understand the symbol?

Is it a linker error, telling you that there's no definition of the method?

Is it something else?
In main you created a vector of your vectorsoo class. Try making an object of your type, not a vector of objects:
1
2
3
4
5
vectorsoo vo;

int number;
cin >> number;
vo.addNumber(number);
Nevermind I figured it out. Booradley60 you were right, I didn't realize that the class itself had the vector. Beginners mistake. Thank you both!
Topic archived. No new replies allowed.