Suppose I have a vector that is of class X data type. I was wondering if I could access the classes functions through the iterator of the vector, and if I could then what would the code look like? Would I just call the function the way I would normally I would I have to use -> to call the functions

Yea, if this is what you mean :

#include <iostream>
#include <vector>
#include <string>
using namespace std;

typedef string Type;

int main(){

  std::vector<Type> msg(2,"a");
  std::vector<Type>::iterator itr = msg.begin();
 
  while(itr != msg.end()){ 
	  cout << itr->data() << endl; 
	  ++itr; 
  }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.