Can anyone explain me why does this happened?
When I call member function printEvent() inside the block of if-else,I get the correct output,but when I call printEvent() after the block I get this unknown result.
list<Event*> currentEvents;
for (j=1; j <= eventsNum; ++j)
{
Event * newEvent;
if (isIndividual(inFile)) {
IndividualEvent newIndi = returnIndi(inFile);
newEvent = &(newIndi);
newEvent->printEvent();
}else {
TeamEvent newTeam = returnTeam(inFile);
newEvent = &(newTeam);
newEvent->printEvent();
}
cout << "WHY?" << endl;
newEvent->printEvent();
currentEvents.push_back(newEvent);
}
TVNode.push_back(newEmission);
}
OUTPUT
<Filiko1>
WHY HERE?
<Filiko1q<15-06-2015,14:00<Athens<0`W ����Athensq<Football<1<0>!0����Footballq<2q<Olympiakos<PSG!
����OlympiakosxW^��DW����PSG^��DWPW�^��DWi�n
The above code is part of a big exercise!