Is it correct to put dynamic_cast
in loop??
//Searches for the reservation with the given reservation number, and //deletes it. Uses the confirmReservation function if the reservation to be //deleted was an OK one
void cancelReservation(string resNum)
{
for (int i=0;i<seats+waitingListMax;i++)
{
for (int seat=i;seat<seats;seat++)
{
Ok* okptr=dynamic_cast <Ok*>(reservations[seat]);
}
for ( int wait=seats;wait<seats+waitingListMax;wait++)
{
Waiting* waitingptr=dynamic_cast <Waiting*>(reservations[wait]);
}
if ((reservations[i]!=0) && (reservations[i]->getReservationNumber()==resNum))
if (okptr)
{
//doing somting
}
if (waitptr)
{
//doing somthing else
}
}