#include <iostream>
#include <vector>
using namespace std;
class ctcChanID
{
public:
void GetInfo(ctcChanID *m);
int chanID;
int type;
string DN;
int clientID;
};
void ctcChanID::GetInfo(ctcChanID *m)
{
}
int main()
{
vector<ctcChanID*> _ctc;
for(int i = 0; i < 2 ; i++)
{
ctcChanID *a = new ctcChanID;
cout << a << endl;
a->chanID = i;
a->type = 3;
a->DN = "374847";
a->clientID = 0;
_ctc.push_back(a);
}
vector<ctcChanID*>::iterator iter;
for(iter = _ctc.begin(); iter != _ctc.end(); ++iter)
{
cout << *iter->chanID << endl;
}
return 0;
}
when I compile the codes, it always generate the error:
error: request for member ‘chanID’ in ‘* iter. __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator-> [with _Iterator = ctcChanID**, _Container = std::vector<ctcChanID*, std::allocator<ctcChanID*> >]()’, which is of non-class type ‘ctcChanID*’
I cannot understand it,