This code tells me that there is no member variable named _number. I have tried using an -> but that doesn't work either.
#include<vector>
#include<iostream>
using namespace std;
class item
{
public:
int _number;
item( int num )
{
_number = num;
}
};
int main()
{
item* first_item = new item( 5 );
vector< item* > items;
items.push_back( first_item );
vector< item* >::iterator it = items.begin();
while( it != items.end() )
{
cout << *it._number << endl;
++it;
}
return 0;
}
Last edited on
operator precedence problem