//declared my vector as vector<candidate> vecList; //pretty standard stuff //do some looping, gather info vecList.push_back(candidate(name,voteCount));
candidate is my class name. So instead of passing an object to push_back, I pass my class name using an overloaded construtor and it works just fine. Upon further investigation, I used an iterator to loop through and display each object, and it properly stores the information, but here comes the curveball.... each element of my vector is stored at the same memory address. Anyone know why?
Edited 6 Years Ago by LevyDee: n/a