I call this method and pass the list as an argument, but the list doesn't change. Why doesn't it work? I have declared the classes Person and Trainer which work fine. There is something wrong here:
Code:void read_people(list<Person *> obj1) { char input; while (cin >> input) if (input== ’t’) { Trainee t; cin >> t; obj1.push_back(&t); } else if (input == ’ts’) { Trainer ts; cin >> ts; obj1.push_back(&ts); } }
Thanx,
John




Reply With Quote