Banemus
Legacy Member
class Gun{
void Gun:
hoot(){
cout >> "BANG\n" ;
}
};
main(){
vector<Gun*> vGuns;
vGuns.push_back(new Gun());
vGuns.push_back(new Gun());
for (vector::iterator it = vGuns.begin(); it!=vGuns.end(); ++it; ){
//Hoe kan ik hier nu met de variabele it de Shoot methode activeren?
*it->Shoot(); werkt blijkbaar niet
it->Shoot(); ook niet
}
}
void Gun:
hoot(){cout >> "BANG\n" ;
}
};
main(){
vector<Gun*> vGuns;
vGuns.push_back(new Gun());
vGuns.push_back(new Gun());
for (vector::iterator it = vGuns.begin(); it!=vGuns.end(); ++it; ){
//Hoe kan ik hier nu met de variabele it de Shoot methode activeren?
*it->Shoot(); werkt blijkbaar niet
it->Shoot(); ook niet
}
}

