Reputation: 15
I made a list of custom objects here is part of my code :
list<Carre*> mechants;
mechants.push_front(new Carre(joueur.getX()-1500,joueur.getY()+100));left = false;
for(list<Carre*>::iterator i=mechants.begin(); i != mechants.end(); ++i)
{
*i->IA(joueur);
}
error: request for member 'IA' in '* i.std::_List_iterator<_Tp>::operator->()', which is of pointer type 'Carre*' (maybe you meant to use '->' ?)|
Mayby the problem is i make a list of Carre* and i should try to do a list of Carre instead but i don't know how to add them in that case. I already tried to do **i->IA(joueur) without succes; I never used a list of custom object before so i don't know what to do.
edit : IA(Joueur) is a function of class Carre
Upvotes: 1
Views: 354
Reputation: 38218
*i->IA(joueur);
is trying to do *(i->IA(joueur));
What you want is parentheses around i
:
(*i)->IA(joueur);
Upvotes: 2