ores is a temporary object. It will go out of scope and die as soon as the reserveSeat function exits.
You are taking a pointer to ores and putting it in your reservations array. As soon as ores dies... this becomes a bad pointer as the object it is pointing to no longer exists.
You probably will need to dynamically allocate the object so it has a sustained lifetime:
1 2
// OKReservation ores(psngr,smoker,date,true); // <- get rid of this
reservations[ReservationCount] = new OKReservation(psngr,smoker,date,true); //<- do this instead
Of course... this also means you'll have to delete all the objects since you're not using smart pointers. And of course... since you are dynamically allocating the reservations array as well, you should be delete[]-ing that as well. Failure to do these deletes will cause memory leaks in your program.
Access violations are typically caused by you dereferencing a bad pointer.
If the address it's giving you is very close to zero (like 0x00000005 or something) then you're probably dereferencing a null pointer somewhere.
Or... if the address is close to a fixed pattern... like 0xCDCDCDD4 or something... then you're probably dereferencing an uninitialized pointer somewhere.
In either case... when you get the error message... if you're running from a debugger (which you should be!) the debugger should snap and tell you exactly what line of code is causing the access violation. Post that code here. It doesn't look to me like the problem would be anywhere in the code you already posted.
I need to know one more thing where am I suppose to delete the objects ?
That's really a design decision you have to make. Whenever you dynamically allocate memory, you should think about which bit of your code is going to take ownership of that memory and be responsible for deleting it.
Since reservations is a data member of your Flight class, and the code within Flight is allocating the memory for it, it looks as though Flight is taking ownership of that memory. In which case, the destructor for Flight should probably be the place to delete that memory.
But you know the rest of your code, and we don't, so it may be that there's a more appropriate place.